Index: firmware/App/Controllers/Switches.c =================================================================== diff -u -r256d5cb05f1ef09e19e2f2733a111f600c73a7ee -re6c4c61c793a91f9ed9dfe969e01bdeee565347d --- firmware/App/Controllers/Switches.c (.../Switches.c) (revision 256d5cb05f1ef09e19e2f2733a111f600c73a7ee) +++ firmware/App/Controllers/Switches.c (.../Switches.c) (revision e6c4c61c793a91f9ed9dfe969e01bdeee565347d) @@ -100,8 +100,11 @@ currentSwitchStatus = ( getFPGADialysateCapStatus() != 0 ? STATE_OPEN : STATE_CLOSED ); break; - // NOTE: the default case was removed since this switch case is executed using a for loop so the default - // case is never called. The default case is unreachable in development testing. +#ifndef _VECTORCAST_ + default: + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_SWITCH_SELECTED, i ); + break; +#endif } // Check if the current switch status is not the same as the recorded data @@ -115,16 +118,23 @@ // If the debounce time has been elapsed, update the switch status to the new status else if ( TRUE == didTimeout( switchesStatus[ i ].debounceStartTime, SWITCHES_DEBOUNCE_TIME_MS ) ) { - if ( CONCENTRATE_CAP == i ) + switch ( i ) { - SEND_EVENT_WITH_2_U32_DATA( DG_EVENT_CONCENTRATE_CAP_SWITCH_CHANGE, - (U32)switchesStatus[ i ].status.data, (U32)currentSwitchStatus ); + case CONCENTRATE_CAP: + SEND_EVENT_WITH_2_U32_DATA( DG_EVENT_CONCENTRATE_CAP_SWITCH_CHANGE, (U32)switchesStatus[ i ].status.data, (U32)currentSwitchStatus ); + break; + + case DIALYSATE_CAP: + SEND_EVENT_WITH_2_U32_DATA( DG_EVENT_DIALYSATE_CAP_SWITCH_CHANGE, (U32)switchesStatus[ i ].status.data, (U32)currentSwitchStatus ); + break; + +#ifndef _VECTORCAST_ + default: + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_SWITCH_SELECTED, i ); + break; +#endif } - else if ( DIALYSATE_CAP == i ) - { - SEND_EVENT_WITH_2_U32_DATA( DG_EVENT_DIALYSATE_CAP_SWITCH_CHANGE, - (U32)switchesStatus[ i ].status.data, (U32)currentSwitchStatus ); - } + switchesStatus[ i ].debounceStartTime = 0; switchesStatus[ i ].status.data = currentSwitchStatus; }