Skip to content

File LinkRecovery.h

FileList > Firmware > Libraries > SimGateway > LinkRecovery.h

Go to the source code of this file

USB self-recovery ladder for SimGateway — pure decision logic, no hardware.More...

  • #include <stdint.h>

Namespaces

Type Name
namespace OpenSkyhawk
Thin wrapper over Adafruit_ADS1115; see ADS1115.h .

Classes

Type Name
struct LinkRecovery
Ladder state. Zero-initialised = healthy, no backoff.

Detailed Description

The SimGateway is powered only from its USB-C, so while it runs it is plugged into something. Running but not configured by a host is therefore abnormal, and the failure this exists for (#355) looks exactly like that: the device dropped off the bus while the core kept running, and only a power cycle brought it back. The ladder escalates:

  • unhealthy for LINK_BAD_MS → detach, then attach LINK_REATTACH_GAP_MS later (toggles the D+ pull-up: the host sees a fresh plug-in)
  • still unhealthy LINK_REBOOT_AFTER_MS → reboot (fully resets the USB controller)
  • after a recovery reboot → re-attach every LINK_BACKOFF_MS, never reboot again until the link has been healthy once

Step 3 keeps a SimGateway on a charger, or back-fed with no host, from reboot-looping.

Pure: takes now and the sampled health, returns what to do. SimGateway.cpp applies the action, so SIMGATEWAY_TEST builds drive the whole ladder with injected inputs.

Copyright:

GPL-2.0-only — see Firmware/LICENSE


The documentation for this class was generated from the following file Firmware/Libraries/SimGateway/LinkRecovery.h