Changeset 6bd7144 in thomson for elec/CrO2/software/gui.cpp


Ignore:
Timestamp:
Jan 22, 2013, 6:25:57 PM (11 years ago)
Author:
Adrien Destugues <pulkomandy@…>
Branches:
main
Children:
65a4aad
Parents:
e017851
Message:

More work on Haiku port

git-svn-id: svn://localhost/thomson@29 85ae3b6b-dc8f-4344-a89d-598714f2e4e5

File:
1 edited

Legend:

Unmodified
Added
Removed
  • elec/CrO2/software/gui.cpp

    re017851 r6bd7144  
    2020int pollStatus(Ihandle* ih)
    2121{
     22        uint8_t status;
    2223        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) {
    3127                // Silently ignore exception if device is not available - not a good
    3228                // idea to handle it from a timer...
    3329                // Keep the timer running so it starts working when the device is
    3430                // 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
    3639        return IUP_DEFAULT;
    3740}
     41
    3842
    3943void startPolling(Ihandle* target) {
Note: See TracChangeset for help on using the changeset viewer.