Index: firmware/App/Controllers/Switches.c =================================================================== diff -u -r73c7fed62a1ca2e4c3cc020a0d5f012c5128e592 -rc2fe204db1b8926994b5eee78afa1b516c97d02c --- firmware/App/Controllers/Switches.c (.../Switches.c) (revision 73c7fed62a1ca2e4c3cc020a0d5f012c5128e592) +++ firmware/App/Controllers/Switches.c (.../Switches.c) (revision c2fe204db1b8926994b5eee78afa1b516c97d02c) @@ -46,7 +46,7 @@ // Initialize all the switches for ( i = 0; i < NUM_OF_DOORS_AND_CAPS; i++ ) { - switchStatus[ i ].data = (U32)CLOSED; + switchStatus[ i ].data = (U32)STATE_CLOSED; } } @@ -61,9 +61,9 @@ { if ( ++switchesFPGAStatusCheckCounter > SWITCHES_FPGA_STATUS_CHECK_INTERVAL ) { - switchStatus[ CONCENTRATE_CAP ].data = (U32)( getFPGAGFluidDoorStatus() != 0 ? OPEN : CLOSED); // TODO change the logic orientation? - switchStatus[ DIALYSATE_CAP ].data = (U32)( getFPGADialysateCapStatus() != 0 ? OPEN : CLOSED); - switchStatus[ FLUID_DOOR ].data = (U32)( getFPGAConcentrateCapStatus() != 0 ? OPEN : CLOSED); + switchStatus[ CONCENTRATE_CAP ].data = (U32)( getFPGAGFluidDoorStatus() != 0 ? STATE_CLOSED : STATE_OPEN ); + switchStatus[ DIALYSATE_CAP ].data = (U32)( getFPGADialysateCapStatus() != 0 ? STATE_CLOSED : STATE_OPEN ); + switchStatus[ FLUID_DOOR ].data = (U32)( getFPGAConcentrateCapStatus() != 0 ? STATE_CLOSED : STATE_OPEN ); switchesFPGAStatusCheckCounter = 0; } @@ -79,20 +79,27 @@ * @param switchId which is the switch that its status is requested * @return switch status *************************************************************************/ -SWITCH_STATUS_T getSwitchStatus( SWITCH_T switchId ) +OPN_CLS_STATE_T getSwitchStatus( SWITCH_T switchId ) { U32 status; - if ( OVERRIDE_KEY == switchStatus[ switchId ].override ) + if ( switchId < NUM_OF_DOORS_AND_CAPS ) { - status = switchStatus[ switchId ].ovData; + if ( OVERRIDE_KEY == switchStatus[ switchId ].override ) + { + status = switchStatus[ switchId ].ovData; + } + else + { + status = switchStatus[ switchId ].data; + } } else { - status = switchStatus[ switchId ].data; + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_DG_INVALID_SWITCH_ID, (U32)switchId ) } - return (SWITCH_STATUS_T)status; + return (OPN_CLS_STATE_T)status; } // ********** private functions ********** @@ -141,6 +148,7 @@ return result; } + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/