Changeset 6bd7144 in thomson for elec/CrO2/software/gui.cpp
- Timestamp:
- Jan 22, 2013, 6:25:57 PM (11 years ago)
- Branches:
- main
- Children:
- 65a4aad
- Parents:
- e017851
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
elec/CrO2/software/gui.cpp
re017851 r6bd7144 20 20 int pollStatus(Ihandle* ih) 21 21 { 22 uint8_t status; 22 23 try { 23 Ihandle* motoron = (Ihandle*)IupGetAttribute(ih, "target"); 24 25 uint8_t status = Device::getDevice().getStatus(); 26 if (status & 8) 27 IupSetAttribute(motoron, "VALUE", "0"); // motor OFF 28 else 29 IupSetAttribute(motoron, "VALUE", "1"); // motor ON 30 } catch(const char*) { 24 Device& dev = Device::getDevice(); 25 status = dev.getStatus(); 26 } catch(const char* ex) { 31 27 // Silently ignore exception if device is not available - not a good 32 28 // idea to handle it from a timer... 33 29 // Keep the timer running so it starts working when the device is 34 30 // plugged 35 } 31 return IUP_DEFAULT; 32 } 33 34 Ihandle* motoron = (Ihandle*)IupGetAttribute(ih, "target"); 35 if (status & 8) 36 IupSetAttribute(motoron, "VALUE", "0"); // motor OFF 37 else 38 IupSetAttribute(motoron, "VALUE", "1"); // motor ON 36 39 return IUP_DEFAULT; 37 40 } 41 38 42 39 43 void startPolling(Ihandle* target) {
Note:
See TracChangeset
for help on using the changeset viewer.