Commit 7fbd72d
Stay off the air while a computer has the config drive mounted
The amplifier draws a few hundred milliamps for the several seconds an
SF12 frame is on the air, and some PC USB ports cannot hold 5 V through
that. The undervoltage resets the tracker - in the worst case while the
host still has the config drive mounted and half-written.
Enumeration is the signal, not the mass-storage mount, because there is
no dependable mount signal to use: FatFSUSB's onPlug only fires on a
SCSI START STOP UNIT load, which no operating system sends when it
mounts a volume, and PREVENT/ALLOW MEDIUM REMOVAL is optional per host.
tud_mounted() reports SET_CONFIGURATION, which is mandatory USB and
behaves the same on macOS, Windows and Linux. A charger and the 13.8 V
Powerpole never enumerate anything, so a deployed tracker is unaffected.
Ejecting has to keep meaning something. The eject already reboots to
apply the new config, and a reboot re-enumerates, so the host would
simply mount the volume again and the tracker would go quiet for good.
The eject is therefore latched into watchdog scratch[2] - which survives
a soft reset but not a power cycle - and the boot that follows reports
no medium, so nothing can mount it and the inhibit has nothing left to
hold. The latch is dropped before reset_usb_boot() so a freshly flashed
board still comes up with its drive.
The gate sits above sb.shouldBeacon() rather than at the radio. Taking
the beacon decision and then suppressing the RF would burn a sequence
number into flash for a frame nobody hears, stamp lastVoltageWarning on
an alert that never went out, and clear metadataForced. Suppressing
between shouldBeacon() and updateAfterBeacon() would be worse still: the
SmartBeacon anchor stays unset, which makes shouldBeacon() true on every
50 ms pass and erases a flash sector each time. loraSendText() keeps a
backstop so no future path can key the PA behind the gate's back.
usbTxInhibit=false is the escape hatch. A car head unit is a USB host
and would otherwise hold an in-car tracker silent for the whole journey.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent 49a5dad commit 7fbd72d
4 files changed
Lines changed: 269 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
67 | 92 | | |
68 | 93 | | |
69 | 94 | | |
| |||
100 | 125 | | |
101 | 126 | | |
102 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
103 | 132 | | |
104 | 133 | | |
105 | 134 | | |
| |||
118 | 147 | | |
119 | 148 | | |
120 | 149 | | |
121 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
122 | 153 | | |
123 | 154 | | |
124 | 155 | | |
| |||
151 | 182 | | |
152 | 183 | | |
153 | 184 | | |
| 185 | + | |
| 186 | + | |
154 | 187 | | |
155 | 188 | | |
156 | 189 | | |
| |||
163 | 196 | | |
164 | 197 | | |
165 | 198 | | |
166 | | - | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
167 | 207 | | |
168 | 208 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
60 | 65 | | |
61 | 66 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
29 | 34 | | |
30 | 35 | | |
31 | 36 | | |
| |||
98 | 103 | | |
99 | 104 | | |
100 | 105 | | |
| 106 | + | |
101 | 107 | | |
102 | 108 | | |
103 | 109 | | |
| |||
143 | 149 | | |
144 | 150 | | |
145 | 151 | | |
| 152 | + | |
146 | 153 | | |
147 | 154 | | |
148 | 155 | | |
| |||
226 | 233 | | |
227 | 234 | | |
228 | 235 | | |
| 236 | + | |
| 237 | + | |
229 | 238 | | |
230 | 239 | | |
231 | 240 | | |
| |||
314 | 323 | | |
315 | 324 | | |
316 | 325 | | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
317 | 331 | | |
318 | 332 | | |
319 | 333 | | |
| |||
360 | 374 | | |
361 | 375 | | |
362 | 376 | | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
363 | 381 | | |
364 | 382 | | |
365 | 383 | | |
| |||
0 commit comments