Index: firmware/App/Controllers/Switches.c =================================================================== diff -u -r69b93e39861c5493d273f25d9e43cacd0b5819e2 -rce596a29a2bd6384d70b2fe7b9c332b0f1f37a84 --- firmware/App/Controllers/Switches.c (.../Switches.c) (revision 69b93e39861c5493d273f25d9e43cacd0b5819e2) +++ firmware/App/Controllers/Switches.c (.../Switches.c) (revision ce596a29a2bd6384d70b2fe7b9c332b0f1f37a84) @@ -27,7 +27,7 @@ static U32 switchesDataPublicationCounter; ///< Switches data publication counter. static OVERRIDE_U32_T switchesDataPublishInterval = { SWITCHES_DATA_PUB_INTERVAL, SWITCHES_DATA_PUB_INTERVAL, 0, 0 }; ///< Interval (in ms) at which to publish switches data to CAN bus. -static SWITCH_STATUS_T switchesStatus[ NUM_OF_DOORS_AND_SWITCHES ]; ///< Switches status array. +static SWITCH_STATUS_T switchesStatus[ NUM_OF_DOORS_AND_SWITCHES ]; ///< Switches status array. // ********** private function prototypes ********** @@ -101,7 +101,9 @@ else if ( TRUE == didTimeout( switchesStatus[ i ].debounceStartTime, SWITCHES_DEBOUNCE_TIME_MS ) ) { switchesStatus[ i ].debounceStartTime = 0; - switchesStatus[ i ].status.data = currentSwitchStatus; + // 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 ); } } else Index: firmware/App/Services/FPGA.c =================================================================== diff -u -rfa27f8d2dba32416ff6b310b192b9adb5fee6997 -rce596a29a2bd6384d70b2fe7b9c332b0f1f37a84 --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision fa27f8d2dba32416ff6b310b192b9adb5fee6997) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision ce596a29a2bd6384d70b2fe7b9c332b0f1f37a84) @@ -100,8 +100,8 @@ #define FPGA_PBO_TEMP_OFFSET 50.0 ///< Used in conversion of PBo temperature reading to deg C. #define FPGA_ALARM_AUDIO_VOLUME_SHIFT 3 ///< Shift alarm audio volume 3 bits to left before writing to register. -#define FRONT_DOOR_SWITCH_MASK 0x0010 ///< Front door switch bit mask. -#define PUMP_TRACK_SWITCH_MASK 0x0020 ///< Pump track switch bit mask. +#define FRONT_DOOR_SWITCH_MASK 0x0010 ///< Front door switch bit mask. Bit 4 of the GPIO register. +#define PUMP_TRACK_SWITCH_MASK 0x0020 ///< Pump track switch bit mask. Bit 5 of the GPIO register. // FPGA Sensors Record #pragma pack(push,1)