Index: firmware/App/Controllers/Switches.c =================================================================== diff -u -r076d41f2a507a2f1e5ceb929100bd025cee3b840 -rf5f00981805e265ce63058f650d784f06db4d188 --- firmware/App/Controllers/Switches.c (.../Switches.c) (revision 076d41f2a507a2f1e5ceb929100bd025cee3b840) +++ firmware/App/Controllers/Switches.c (.../Switches.c) (revision f5f00981805e265ce63058f650d784f06db4d188) @@ -68,20 +68,19 @@ void execSwitches( void ) { U08 i; + U16 currentSwitchStatus; - U16 currentSwitchStatus = 0; - for ( i = 0; i < NUM_OF_DOORS_AND_SWITCHES; i++ ) { // Get the current switch status switch ( i ) { case FRONT_DOOR: - currentSwitchStatus = getFPGAFrontDoorStatus(); + currentSwitchStatus = ( 0 == getFPGAFrontDoorStatus() ? STATE_OPEN : STATE_CLOSED ); break; case PUMP_TRACK_SWITCH: - currentSwitchStatus = getFPGAPumpTrackSwitchStatus(); + currentSwitchStatus = ( 0 == getFPGAPumpTrackSwitchStatus() ? STATE_OPEN : STATE_CLOSED ); break; default: @@ -103,7 +102,7 @@ switchesStatus[ i ].debounceStartTime = 0; // If the bit is 0, the door switch is open, because it is normally open switch // TODO investigate the polarity of the pump track switch once it tied to the cartridge latch - switchesStatus[ i ].status.data = ( 0 == currentSwitchStatus ? STATE_OPEN : STATE_CLOSED ); + switchesStatus[ i ].status.data = currentSwitchStatus; } } else