diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/Leds.c b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/Leds.c index eab0a5f..f9c94ed 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/Leds.c +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/Leds.c @@ -102,16 +102,27 @@ ErrorStatus Led_construct(struct Gpio* onboardGreen, struct Gpio* onboardOrange, extern void Led_on(Led led) { char bufferTrue = (char)true; + char bufferFalse = (char)false; if (self.initialized) { if (self.leds[led].initialized) { - // IN case of the BICOLOUR ORANGE LED, actually the GREEN and RED LEDs must be switched + // IN case of the BICOLOUR LED, actually the GREEN and RED LEDs must be switched if (led == LED_BICOLOR_ORANGE) { IODevice_write(self.leds[LED_BICOLOR_GREEN].ioDevice, &bufferTrue, 1); IODevice_write(self.leds[LED_BICOLOR_RED].ioDevice, &bufferTrue, 1); } + else if (led == LED_BICOLOR_GREEN) + { + IODevice_write(self.leds[LED_BICOLOR_GREEN].ioDevice, &bufferTrue, 1); + IODevice_write(self.leds[LED_BICOLOR_RED].ioDevice, &bufferFalse, 1); + } + else if (led == LED_BICOLOR_RED) + { + IODevice_write(self.leds[LED_BICOLOR_GREEN].ioDevice, &bufferFalse, 1); + IODevice_write(self.leds[LED_BICOLOR_RED].ioDevice, &bufferTrue, 1); + } else { IODevice_write(self.leds[led].ioDevice, &bufferTrue, 1); @@ -135,6 +146,7 @@ extern void Led_off(Led led) IODevice_write(self.leds[LED_BICOLOR_GREEN].ioDevice, &bufferFalse, 1); IODevice_write(self.leds[LED_BICOLOR_RED].ioDevice, &bufferFalse, 1); } + else { IODevice_write(self.leds[led].ioDevice, &bufferFalse, 1); diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/repairMenu.c b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/repairMenu.c index 27affad..b9e5ac1 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/repairMenu.c +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/repairMenu.c @@ -1071,10 +1071,23 @@ void repairMenu_menuStateHandle(struct MenuCore* self) { // Stop the buzzer from recovered error or warning - if ((self->lastMenuState == RM_ERROR_STATE) || (self->lastMenuState == RM_WARNING_STATE)) + if (self->lastMenuState == RM_ERROR_STATE) { - if ((self->menuState != RM_ERROR_STATE) && (self->menuState != RM_WARNING_STATE)) - Buzzer_stop(self->buzzer); + if (self->menuState != RM_ERROR_STATE) + { + Buzzer_stop(self->buzzer); + Led_off(LED_BICOLOR_RED); + } + } + + // Stop the buzzer from recovered error or warning + if (self->lastMenuState == RM_WARNING_STATE) + { + if (self->menuState != RM_WARNING_STATE) + { + Buzzer_stop(self->buzzer); + Led_off(LED_BICOLOR_ORANGE); + } } // Catch ERROR state @@ -1083,6 +1096,7 @@ void repairMenu_menuStateHandle(struct MenuCore* self) self->lastMenuState = self->menuState; // Show ERROR message repairMenu_printError(self); + Led_on(LED_BICOLOR_RED); // Handle error if (hsb_safetyIsEnabled()) { @@ -1093,6 +1107,7 @@ void repairMenu_menuStateHandle(struct MenuCore* self) { self->lastMenuState = self->menuState; repairMenu_printWarning(self); + Led_on(LED_BICOLOR_ORANGE); } else if (self->menuState == RM_PRESET_PRINT) @@ -1104,6 +1119,8 @@ void repairMenu_menuStateHandle(struct MenuCore* self) { // Check the remaining repair time uint32_t remainingTime = repairProcess_getRemainingRepairTime(repairProcesses_getMainRepairProcess()); + + Led_on(LED_BICOLOR_GREEN); if (remainingTime > (2 * REPAIRMENU_POPUPSCREEN_TIME_MS / 1000)) { self->popUpCounter = remainingTime - (2 * REPAIRMENU_POPUPSCREEN_TIME_MS / 1000); @@ -1134,6 +1151,7 @@ void repairMenu_menuStateHandle(struct MenuCore* self) else if (self->menuState == RM_REPAIR_PAUSE) { repairMenu_printPause(self); + Led_off(LED_BICOLOR_GREEN); } else if (self->menuState == RM_FINISH_CONTROL) { @@ -1144,6 +1162,7 @@ void repairMenu_menuStateHandle(struct MenuCore* self) else if (self->menuState == RM_FINISH) { repairMenu_printFinish(self); + Led_off(LED_BICOLOR_GREEN); } else if (self->menuState == RM_ADMINMENU_PIN_VERIFICATION)