Small fixes: airtime fallback underflow, LLCC68 wrapper build, CLI gps crash, host test build - #8
Open
mmmorks wants to merge 1 commit into
Open
Small fixes: airtime fallback underflow, LLCC68 wrapper build, CLI gps crash, host test build#8mmmorks wants to merge 1 commit into
mmmorks wants to merge 1 commit into
Conversation
…host tests
Five small independent fixes.
calcMaxPacketMillis()'s fallback said "4 secs" and used 4000 - preamble_us,
i.e. 4 ms minus a preamble that exceeds it at every setting there is. The
unsigned subtraction underflows, and the result is not a mis-sized deadline
but the absence of one: a ~49-day payload watchdog leaves
CustomSX1262::isReceiving() holding a latched HEADER_VALID true forever, so
the channel never again reads idle. The fallback is now a flat 4 s of
payload (MAX_PACKET_FALLBACK_PAYLOAD_US, overridable), with no subtraction
left to underflow. It is only reached when getTimeOnAir() returns nothing
usable, which it does on an unconfigured modem.
CustomLLCC68Wrapper::doResetAGC() calls sx126xResetAGC() with one argument;
the only overload takes (SX126x*, bool rx_boost_gain). Nothing in the tree
includes this wrapper yet, which is why no build has failed, but the first
board to use it will. Pass getRxBoostedGainMode() like the SX1262, SX1268
and STM32WLx wrappers do.
The bare `gps` CLI command crashes when no GPS was detected: the status
branch does strcmp(_sensors->getSettingByKey("gps"), "1") and
getSettingByKey() returns NULL when no "gps" setting is registered, which
is the case whenever gps_detected was false at boot. Treat a missing
setting as "deactivated".
recvRaw()'s readData() error line now also prints the packet length, RSSI
and SNR (quarter-dB, the same convention as Packet::_snr). The bare error
code says nothing about the cause -- a packet at the edge of the
demodulator and one lost to a collision both produce -7 -- and both
existing packet loggers sit inside the success branch, so a failed receive
is otherwise invisible to `log start` and MESH_PACKET_LOGGING alike. The
modem's packet-status registers are written whether or not the CRC passed,
so this costs no extra SPI traffic. Measured on a live repeater at
SF7/62.5 kHz (490 failures against 961 successes over 25 min), the
failure rate resolves into a clean waterfall against SNR, with 20% of
failures at positive SNR where marginality cannot be the explanation.
ConfigSerializer.cpp calls atoi/atol/atof and reaches them through
Arduino.h on MCU targets, but not in the host `native` googletest build:
on macOS the whole suite fails to compile at ConfigSerializer.o, taking
every unit test down with it. Include <stdlib.h>. Likewise
LocationProvider::sendSentence() was declared virtual but never defined;
every current subclass overrides it so MCU links get away with it, but a
translation unit that emits the base vtable gets an undefined reference.
Give it an empty default body, matching the no-op override in
EnvironmentSensorManager.cpp.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EXSCjgNEbJfHwLjD2WSHW4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Five small, independent fixes, each self-contained in its own commit hunk.
calcMaxPacketMillis()fallback underflow (src/helpers/radiolib/RadioLibWrappers.cpp). WhengetTimeOnAir()returns nothing usable (it returns 0 on an unconfigured modem) the fallback said "4 secs" but used4000 - preamble_us, i.e. 4 ms minus a preamble that exceeds it at every setting there is. The unsigned subtraction underflows, and the result is not a mis-sized deadline but the absence of one: a ~49-day payload watchdog leavesCustomSX1262::isReceiving()holding a latchedHEADER_VALIDtrue forever, so the channel never again reads idle. The fallback is now a flat 4 s of payload (MAX_PACKET_FALLBACK_PAYLOAD_US, overridable) with no subtraction left to underflow.CustomLLCC68Wrapper::doResetAGC()does not compile. It callssx126xResetAGC()with one argument; the only overload takes(SX126x*, bool rx_boost_gain). Nothing in the tree currently includes this wrapper, which is why no build has failed, but the first board to use it will. PassgetRxBoostedGainMode()like the SX1262/SX1268/STM32WLx wrappers do.gpsCLI command crashes when no GPS was detected (src/helpers/CommonCLI.cpp). The status branch doesstrcmp(_sensors->getSettingByKey("gps"), "1"), andgetSettingByKey()returnsNULLwhen nogpssetting is registered — which is the case whenevergps_detectedwas false at boot. Treat a missing setting as "deactivated".Failed-receive diagnostics (
RadioLibWrappers.cpp). ThereadData()error line now also prints the packet length, RSSI and SNR (quarter-dB, the same convention asPacket::_snr). The modem writes its packet-status registers whether or not the CRC passed, so this costs no extra SPI traffic and is enough to tell a failure distribution sitting on the SF's SNR floor apart from one spread across strong signals (a collision pattern).Host test build.
ConfigSerializer.cppusesatoi/atol/atofand reaches them throughArduino.hon MCU targets, but not in thenativegoogletest environment: on macOS the whole suite fails to compile atConfigSerializer.o. Include<stdlib.h>. LikewiseLocationProvider::sendSentence()was declared virtual but never defined; every current subclass overrides it, so MCU links get away with it, but any translation unit that emits the base vtable gets an undefined reference. Give it an empty default body, matching the no-op override inEnvironmentSensorManager.cpp.How it was tested
pio test -e native: all suites pass on macOS (before the<stdlib.h>fix none of them compile there).heltec_tracker_v2_repeater(ESP32-S3) andWioTrackerL1_repeater(nRF52).Dependencies
Independent. Applies to
dev.