changed all timers to count-down, prose cleanup

This commit is contained in:
2025-01-21 23:09:53 -05:00
parent 31429c8bea
commit f83c0bc355
2 changed files with 26 additions and 24 deletions
+5 -5
View File
@@ -127,13 +127,13 @@ void respondToButtonTask(uint8 evt) {
case RTB_IDLE:
if (evt == EVT_BUTTON) {
rtbState = RTB_ON;
rtbTimerCount = 0;
rtbTimerCount = BUTTON_LED_ON_TIME;
gpio_set(LED, LED_ON);
}
break;
case RTB_ON:
if (evt == EVT_TICK) {
if (++rtbTimerCount > BUTTON_LED_ON_TIME) {
if (--rtbTimerCount == 0) {
gpio_set(LED, LED_OFF);
rtbState = RTB_IDLE;
}
@@ -144,7 +144,7 @@ void respondToButtonTask(uint8 evt) {
const int LED_ON_TIME = 150;
const int LED_OFF_TIME = 50;
static uint8 ledState = LED_OFF;
static uint8 ledState = LED_OFF;
static uint16 ledTimerCount = 0;
void ledTask(uint8 evt) {
@@ -153,14 +153,14 @@ void ledTask(uint8 evt) {
if (evt == EVT_TICK) {
if (++ledTimerCount > LED_OFF_TIME) {
gpio_set(LED2, LED_ON);
ledTimerCount = 0;
ledTimerCount = LED_ON_TIME;
ledState = LED_ON;
}
}
break;
case LED_ON:
if (evt == EVT_TICK) {
if (++ledTimerCount > LED_ON_TIME) {
if (--ledTimerCount == 0) {
gpio_set(LED2, LED_OFF);
ledTimerCount = 0;
ledState = LED_OFF;