adafruit / adafruit/Adafruit_Wippersnapper_Arduino

[Offline Mode] Implement tracking of auto-config attempts to avoid boot loops

Open
#793 0 comments 0 reactions 0 assignees View on GitHub
enhancement offline-mode
Dominant language
C++
Stars
54
Forks
56
Avg merge
2d 12h
Merged PRs (30d)
11

Description

When the config doesn't exist or auto config settings is not specified, then the offline firmware automatically scans and attempts to initialise i2c devices. This can cause a crash, reboot, and the process then repeats. The device is often not back online long enough to allow the user to remove the config file that caused an issue (or replace with one that doesn't).

Instead we could write the component we are attempting to automatically initialise (and the attempted i2c address) to the config.json, or NVM, and detect that on subsequent reboot if reason is a Watchdog reboot / crash, or if successfully initialised then remove that entry / move on. Then we move on to the next address or component to try in the auto-config routine, whether the first failed (so during the next reboot) or succeeded (so no reboot between), and obviously if the address is now used we skip it, otherwise we attempt the 2nd (etc) component for that i2c address.

Like for 0x44 there are quite a few, but my issue was 0x51 where an RTC was auto-config attempted as a VCNL4200 which caused a crash then repeat infinitely. In my ideal solution, it would crash once, then reboot and skip the vcnl4200 at 0x51 (and then there being no other drivers to attempt for 0x51 would just not configure the device at 0x51 - also saving auto-config:false to the config.json once auto config routine is fully completed and written out).

In a truly ideal world we'd keep track of whether sensors had produced a valid reading yet / ever, and then after enough failures it could be reinitialised, or if never confirmed as that sensor then an attempt could be made to initialise with another i2c address compatible driver.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the offline firmware's auto-config routine and trace how config.json or NVM is read and written, including the attempted I2C component and address. Done should mean a failed attempt survives a watchdog reboot, is skipped on the next boot, successful attempts advance normally, and auto-config is disabled after the routine completes.

Written by the indexing model from the issue text.

Assessment

Tech stack
arduino, cpp
Domain
embedded-iot
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.