cleanup
This commit is contained in:
11
main.c
11
main.c
@ -24,6 +24,8 @@
|
|||||||
#define BUTTON_IGNORE_DURATION_MS 2000U // Time button ignored after long press
|
#define BUTTON_IGNORE_DURATION_MS 2000U // Time button ignored after long press
|
||||||
#define BUTTON_CONFIRMATION_BLINK_LOOPS 10U // Blink animation for confirmation
|
#define BUTTON_CONFIRMATION_BLINK_LOOPS 10U // Blink animation for confirmation
|
||||||
#define BUTTON_CONFIRMATION_BLINK_DURATION_MS 50U
|
#define BUTTON_CONFIRMATION_BLINK_DURATION_MS 50U
|
||||||
|
#define GLOW_BRIGHTNESS_MIN 10U
|
||||||
|
#define GLOW_BRIGHTNESS_MAX 100U
|
||||||
|
|
||||||
/** Convert milliseconds to system ticks */
|
/** Convert milliseconds to system ticks */
|
||||||
#define MS_TO_TICKS(ms) ((ms) / MAIN_LOOP_SLEEP)
|
#define MS_TO_TICKS(ms) ((ms) / MAIN_LOOP_SLEEP)
|
||||||
@ -111,7 +113,6 @@ int main(void)
|
|||||||
set_sleep_mode(SLEEP_MODE_STANDBY); // Deepest sleep mode (standby)
|
set_sleep_mode(SLEEP_MODE_STANDBY); // Deepest sleep mode (standby)
|
||||||
sleep_enable(); // Enable sleep
|
sleep_enable(); // Enable sleep
|
||||||
|
|
||||||
cli(); // Disable global interrupts
|
|
||||||
sei(); // Re-enable interrupts
|
sei(); // Re-enable interrupts
|
||||||
sleep_cpu(); // MCU sleeps here
|
sleep_cpu(); // MCU sleeps here
|
||||||
}
|
}
|
||||||
@ -428,14 +429,14 @@ void ledAnimationGlow(void)
|
|||||||
brightness += direction;
|
brightness += direction;
|
||||||
|
|
||||||
// Reverse direction at limits
|
// Reverse direction at limits
|
||||||
if (brightness >= 100U)
|
if (brightness >= GLOW_BRIGHTNESS_MAX)
|
||||||
{
|
{
|
||||||
brightness = 100U;
|
brightness = GLOW_BRIGHTNESS_MAX;
|
||||||
direction = -1;
|
direction = -1;
|
||||||
}
|
}
|
||||||
else if (brightness == 10U)
|
else if (brightness == GLOW_BRIGHTNESS_MIN)
|
||||||
{
|
{
|
||||||
brightness = 10U;
|
brightness = GLOW_BRIGHTNESS_MIN;
|
||||||
direction = 1;
|
direction = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user