Restructure SW watchdog and fix bug for >3 channels
The feed function considered max. number of channels and not actual number of registered channels, which resulted in undefined behavior if not all channels were used. Also introducing more simple API to hide the software implementation.
This commit is contained in:
+2
-2
@@ -117,7 +117,7 @@ void leds_update_thread()
|
||||
bool flicker_state = true;
|
||||
struct device *led_devs[NUM_LED_PINS];
|
||||
|
||||
int wdt_channel = sw_watchdog_register(1000);
|
||||
int wdt_channel = watchdog_register(1000);
|
||||
|
||||
for (int pin = 0; pin < NUM_LED_PINS; pin++) {
|
||||
led_devs[pin] = device_get_binding(led_ports[pin]);
|
||||
@@ -127,7 +127,7 @@ void leds_update_thread()
|
||||
|
||||
while (true) {
|
||||
|
||||
sw_watchdog_feed(wdt_channel);
|
||||
watchdog_feed(wdt_channel);
|
||||
|
||||
// could be increased to value >NUM_LEDS to reduce on-time
|
||||
if (led_count >= NUM_LEDS) {
|
||||
|
||||
Reference in New Issue
Block a user