Added BiColour led behaviour to menu
git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@360 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
@@ -102,16 +102,27 @@ ErrorStatus Led_construct(struct Gpio* onboardGreen, struct Gpio* onboardOrange,
|
|||||||
extern void Led_on(Led led)
|
extern void Led_on(Led led)
|
||||||
{
|
{
|
||||||
char bufferTrue = (char)true;
|
char bufferTrue = (char)true;
|
||||||
|
char bufferFalse = (char)false;
|
||||||
if (self.initialized)
|
if (self.initialized)
|
||||||
{
|
{
|
||||||
if (self.leds[led].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)
|
if (led == LED_BICOLOR_ORANGE)
|
||||||
{
|
{
|
||||||
IODevice_write(self.leds[LED_BICOLOR_GREEN].ioDevice, &bufferTrue, 1);
|
IODevice_write(self.leds[LED_BICOLOR_GREEN].ioDevice, &bufferTrue, 1);
|
||||||
IODevice_write(self.leds[LED_BICOLOR_RED].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
|
else
|
||||||
{
|
{
|
||||||
IODevice_write(self.leds[led].ioDevice, &bufferTrue, 1);
|
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_GREEN].ioDevice, &bufferFalse, 1);
|
||||||
IODevice_write(self.leds[LED_BICOLOR_RED].ioDevice, &bufferFalse, 1);
|
IODevice_write(self.leds[LED_BICOLOR_RED].ioDevice, &bufferFalse, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IODevice_write(self.leds[led].ioDevice, &bufferFalse, 1);
|
IODevice_write(self.leds[led].ioDevice, &bufferFalse, 1);
|
||||||
|
|||||||
@@ -1071,10 +1071,23 @@ void repairMenu_menuStateHandle(struct MenuCore* self)
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Stop the buzzer from recovered error or warning
|
// 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)
|
||||||
{
|
{
|
||||||
if ((self->menuState != RM_ERROR_STATE) && (self->menuState != RM_WARNING_STATE))
|
|
||||||
Buzzer_stop(self->buzzer);
|
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
|
// Catch ERROR state
|
||||||
@@ -1083,6 +1096,7 @@ void repairMenu_menuStateHandle(struct MenuCore* self)
|
|||||||
self->lastMenuState = self->menuState;
|
self->lastMenuState = self->menuState;
|
||||||
// Show ERROR message
|
// Show ERROR message
|
||||||
repairMenu_printError(self);
|
repairMenu_printError(self);
|
||||||
|
Led_on(LED_BICOLOR_RED);
|
||||||
// Handle error
|
// Handle error
|
||||||
if (hsb_safetyIsEnabled())
|
if (hsb_safetyIsEnabled())
|
||||||
{
|
{
|
||||||
@@ -1093,6 +1107,7 @@ void repairMenu_menuStateHandle(struct MenuCore* self)
|
|||||||
{
|
{
|
||||||
self->lastMenuState = self->menuState;
|
self->lastMenuState = self->menuState;
|
||||||
repairMenu_printWarning(self);
|
repairMenu_printWarning(self);
|
||||||
|
Led_on(LED_BICOLOR_ORANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (self->menuState == RM_PRESET_PRINT)
|
else if (self->menuState == RM_PRESET_PRINT)
|
||||||
@@ -1104,6 +1119,8 @@ void repairMenu_menuStateHandle(struct MenuCore* self)
|
|||||||
{
|
{
|
||||||
// Check the remaining repair time
|
// Check the remaining repair time
|
||||||
uint32_t remainingTime = repairProcess_getRemainingRepairTime(repairProcesses_getMainRepairProcess());
|
uint32_t remainingTime = repairProcess_getRemainingRepairTime(repairProcesses_getMainRepairProcess());
|
||||||
|
|
||||||
|
Led_on(LED_BICOLOR_GREEN);
|
||||||
if (remainingTime > (2 * REPAIRMENU_POPUPSCREEN_TIME_MS / 1000))
|
if (remainingTime > (2 * REPAIRMENU_POPUPSCREEN_TIME_MS / 1000))
|
||||||
{
|
{
|
||||||
self->popUpCounter = 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)
|
else if (self->menuState == RM_REPAIR_PAUSE)
|
||||||
{
|
{
|
||||||
repairMenu_printPause(self);
|
repairMenu_printPause(self);
|
||||||
|
Led_off(LED_BICOLOR_GREEN);
|
||||||
}
|
}
|
||||||
else if (self->menuState == RM_FINISH_CONTROL)
|
else if (self->menuState == RM_FINISH_CONTROL)
|
||||||
{
|
{
|
||||||
@@ -1144,6 +1162,7 @@ void repairMenu_menuStateHandle(struct MenuCore* self)
|
|||||||
else if (self->menuState == RM_FINISH)
|
else if (self->menuState == RM_FINISH)
|
||||||
{
|
{
|
||||||
repairMenu_printFinish(self);
|
repairMenu_printFinish(self);
|
||||||
|
Led_off(LED_BICOLOR_GREEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (self->menuState == RM_ADMINMENU_PIN_VERIFICATION)
|
else if (self->menuState == RM_ADMINMENU_PIN_VERIFICATION)
|
||||||
|
|||||||
Reference in New Issue
Block a user