diff --git a/src/debugger/gui/DrivingWidget.cxx b/src/debugger/gui/DrivingWidget.cxx index cbfda65bd..1f6af768d 100644 --- a/src/debugger/gui/DrivingWidget.cxx +++ b/src/debugger/gui/DrivingWidget.cxx @@ -69,7 +69,7 @@ void DrivingWidget::loadConfig() break; myFire->setState(!myController.read(Controller::Six)); - myGrayValue->setList(0, gray); + setValue(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -82,13 +82,13 @@ void DrivingWidget::handleCommand( myGrayIndex = (myGrayIndex + 1) % 4; myController.set(Controller::One, (ourGrayTable[myGrayIndex] & 0x1) != 0); myController.set(Controller::Two, (ourGrayTable[myGrayIndex] & 0x2) != 0); - myGrayValue->setList(0, ourGrayTable[myGrayIndex]); + setValue(); break; case kGrayDownCmd: myGrayIndex = myGrayIndex == 0 ? 3 : myGrayIndex - 1; myController.set(Controller::One, (ourGrayTable[myGrayIndex] & 0x1) != 0); myController.set(Controller::Two, (ourGrayTable[myGrayIndex] & 0x2) != 0); - myGrayValue->setList(0, ourGrayTable[myGrayIndex]); + setValue(); break; case kFireCmd: myController.set(Controller::Six, !myFire->getState()); @@ -96,5 +96,13 @@ void DrivingWidget::handleCommand( } } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void DrivingWidget::setValue() +{ + int grayCode = ourGrayTable[myGrayIndex]; + // * 8 = a nasty hack, because the DataGridWidget does not support 2 digit binary output + myGrayValue->setList(0, (grayCode & 0b01) + (grayCode & 0b10) * 8); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - uInt8 DrivingWidget::ourGrayTable[4] = { 0x03, 0x01, 0x00, 0x02 }; diff --git a/src/debugger/gui/DrivingWidget.hxx b/src/debugger/gui/DrivingWidget.hxx index b744bc13e..189e66baf 100644 --- a/src/debugger/gui/DrivingWidget.hxx +++ b/src/debugger/gui/DrivingWidget.hxx @@ -51,6 +51,8 @@ class DrivingWidget : public ControllerWidget void loadConfig() override; void handleCommand(CommandSender* sender, int cmd, int data, int id) override; + void setValue(); + // Following constructors and assignment operators not supported DrivingWidget() = delete; DrivingWidget(const DrivingWidget&) = delete;