Back. Go up one level.

HomeBrew Gen3 (HBG3) Firmware Version History


 * Version 8.62 2024-11-26
 *  -- Ensure OLED is ON for ota_update command.
 *  -- Decode model name for Evolution mounts with ancient firmware (7.11.6165).
 *  -- SSAA: treat padding byte values other than 0x02 as "NO padding".
 * Version 8.61 2024-10-28
 *  -- OLED: Speed up first redraw after splash screen.
 *  -- OLED: Don't show "WiFi: Off" while actually connecting to an Access Point.
 * Version 8.60 2024-10-27
 *  -- Revert Nunchuck changes from v8.57: not compatible with some older Nunchucks.
 * Version 8.59 2024-10-20
 *  -- Fix reading of switches on All-In-One (AIO). Was broken for a while.
 *  -- Make it easier to test with a slower I2C clock using I2C_MAX_CLOCK macro.
 * Version 8.58 2024-10-12
 *  -- Fixed missing "wlan.channel" variable on ESP32/HBG3/AIO.
 * Version 8.57 2024-10-12
 *  -- Scan for least-busy channel for WiFi (ESP32).
 *  -- Show wifi channel number on OLED.
 *  -- Fixed test_auxbus command.
 *  -- Fixed auxbus.stopbits=2.
 *  -- Nunchuck handling changed.
 *  -- BW16 I2C gets stuck when Nunchuck is hot-unplugged; worked around it, but might still happen.
 *  -- Tweaks for newer version of RTL8720/BW16 module with different connections to HBG3 PCB.
 *  -- Cosmetic GPS code tweaks to keep newer compilers happy.
 * Version 8.56 2024-08-11
 *  -- Add config flags to completely include/exclude FRAM and I2C code.
 *  -- Tweaks to print_packet().
 *  -- Move rx_pin,tx_pin from bus_s to txq_s.
 *  -- Combine setup() hooks for AIO and REALTEK_BW16 (aka. HBDB).
 *  -- Use different DEV_ addresses for AIO and HBDB, and different HBG3_NAMEs for them too.
 * Version 8.55 2024-08-06
 *  -- Merge the dual-band WiFi/BLE REALTEK_BW16 project.
 *  -- LOTS of little fixes as a result of the REALTEK_BW16's fussier build-chain.
 *  -- Nuke "simple_mode" and associated code.
 *  -- Rename DEV_SCANR to DEV_SCANER (python AUX bus scanner).
 *  -- Improve decoding/emulation of BATT_GET_VOLTAGE.
 * Version 8.54 2024-08-01
 *  -- emulate.mount: add commands needed for simulating CGE-Pro and other mounts.
 *  -- Get rid of workarounds for CPWI cordwrap: CPWI-2.5.6 sends cordwrap commands to both MCs on purpose.
 * Version 8.53 2024-07-30
 *  -- emulate.mount: work around CPWI cordwrap bugs.
 *  -- Implement responses for MC_[GS]ET_AUTOGUIDE_RATE when using mount.override.
 *  -- Add nchuck.slew.speeds variable. Eg. "set nchuck.slew.speeds 4,4,5,5,6,4,5,6,7,9"  (five slow, and five fast speeds).
 *  -- Add mount-id for the Origin.
 *  -- Add new mount.override variable to change reported mount ID for GET_MODEL.
 * Version 8.52 2024-07-27
 *  -- Nuke mount.reversed.alt --> free up the space, and nobody uses it.
 *  -- Cancel auxtests on receipt of any serial/p3000 command.
 *  -- Impose a time-limit on gps auto-baud detection, to reduce overhead when no gps detected.
 *  -- Force OLED redraw after exit from QR screen: was sometimes leaving bits of QR on the display.
 *  -- New 'i' command to toggle ignoring/exclusion of MC_GET_POS packets from tracing.
 *  -- Fixes for BATT_GET_VOLTAGE.
 *  -- Tidy up implementation/tracing of emulated devices.
 *  -- New (partial) mount simulator: enable with "set emulate.mount 1"; mostly complete, but no tracking yet.
 *  -- When available, show measured Dew Input Voltage on the OLED.
 *  -- Increase dew_aggression temperatures by a degree or so.
 * Version 8.51 2024-07-13
 *  -- Minor fixes around DEW_RECALIBRATE_ENV_SENSOR.
 *  -- Make suppress.lowbattery also hide such messages from verbose/trace.
 *  -- Don't do Network Time Protocol (NTP) unless a real/fake GPS is configured.
 *  -- Enable tracing 1 or 2 devices at once with the trace command.  Eg. trace dev1 dev2
 *  -- Measure Dew Heater voltage on ADS1115 channel-3: use external 4:1 (divide-by-5) resistor network on the input.
 *  -- Read thermistor every 3 seconds instead of every 4 seconds.
 *  -- Show p3000 responses when verbose=1.
 * Version 8.50 2024-06-18
 *  -- Add support "get wlan.mac" for CPWI 2.5.6-beta.
 * Version 8.49 2024-06-17
 *  -- Show GPS coordinates as DDD° MM'SS.ss" C, similar to Celestron hand-controller displays.
 *  -- Fix build when EMULATE_SSAA is false.
 *  -- Set default ETHERNET_ENABLED back to true, for benefit of hbg3-aio builds.
 * Version 8.48 2024-05-31
 *  -- Some mounts (eg. CPC) return an extra byte in response to certain cordwrap commands. Deal with it!
 * Version 8.47 2024-05-29
 *  -- Work around CPWI CORDWRAP bug: CPWI uses DEV_ALT instead of DEV_AZM for some (but not all) CORDWRAP commands.
 *  -- Revert to 4-sec p2000_timeout for most stuff; use a longer timeout during SSAA capture activity.
 * Version 8.46 2024-05-11
 *  -- Use P2000_ACTIVITY_TIMEOUT for MUSB as well as WiFi/BT connections.
 *  -- Increase P2000_ACTIVITY_TIMEOUT to 8 seconds (was 4).  SSAA has been observed taking 5-seconds to respond.
 *  -- Dump SSSWI challenge/response pairs together when verbose=1
 *  -- ADS1115: Use I2C clock of 800KHz for lower overhead.
 *  -- ADS1115: use 475 SPS, so that a sample can be read in 2.1msec.
 *  -- Increase default oled.timeout.secs to 120 (was 60).
 * Version 8.45 2024-05-02
 *  -- Add ADS1115 ADC support for thermistors. Wire ADC A0 to 3.3V, A1 to Thm0, A2 to Thm1. ADC A3 is not-used.
 *  -- Incorporate a default ADC_LUT[] table.
 * Version 8.44 2024-05-02
 *  -- Add SSSWI_HACKING: intercept Challenge/Response and feed our own data to SSHC.
 * Version 8.43 2024-04-03
 *  -- New boolean var to reverse ALT direction of Nunchuck:  nchuck.reverse.alt
 * Version 8.42 2024-04-02
 *  -- Never turn off GPS; instead let it run and update it's almanac etc..
 * Version 8.41 2024-04-02
 *  -- Get rid of oled_off_updatefn().
 *  -- New oled.timeout.secs variable, for auto-blanking the OLED. Default 60 seconds.
 *  -- Rename various OLED/Button related identifiers for easier comprehension.
 * Version 8.40 2024-03-13
 *  -- Enable use of 0x?? hex values for most numeric settings.
 * Version 8.39 2024-01-19
 *  -- Get project to build/run with new Arduino ESP32-v3.x.x board support. Also needs new library patches!
 * Version 8.38 2024-01-11
 *  -- Add missing WiFi.persistent(false); to setup().
 *  -- Sort out the pin assignments for Dew Control on the All-In-One (AIO).
 *  -- Fix Dew Control pin assignment logic for Relay+Stepper configurations.
 * Version 8.37 2024-01-08
 *  -- New "dew.force.enabled" boolean variable to enable Dew Control even without a SHT3x sensor being present.
 *  -- Select different thermistor_pins[] and dew_pwm_pins[] when AUXRELAY is wired.
 *  -- Disable Dew Channel-1 if no pins are available for it, due to conflicts with Ethernet, Host-USB, or Stepper motor.
 * Version 8.36 2024-01-07
 *  -- Fix NTP year formatting for transfer to a Celestron hand-controller.
 * Version 8.35 2024-01-07
 *  -- Fix NTP dates by using gmtime_r() instead of buggy local calculations.
 *  -- Change default "dew0.amps" (informational-only) setting from 1.8 to 1.7, matching Celestrons 8" Dew Ring.
 *  -- Enable use of opcode names with the "send" command.
 *  -- Tweaks and tidying to opcode name printing.
 *  -- Fix fake Focus Motor calibration to persist across reset/power cycles.
 *  -- Get rid of "focus.calibrated" variable: focus.limits does same job.
 *  -- Revamp Focus Motor Calibration screen.
 *  -- Enable forcing a temporary ota_update_path on the command line for "ota_update" (also skips version check).
 * Version 8.34 2024-01-04
 *  -- Handle zero-data GET_MODEL response from older Nexstar-GPS firmware versions.
 * Version 8.33 2024-01-03
 *  -- Support ENC28J60 ethernet modules again (build-time option in eth.h).
 *  -- Use WiFi.mode(WIFI_OFF) instead of WiFi.softAPdisconnect(true), to get rid of "esp_wifi_get_mac failed" messages.
 *  -- Don't try contacting NTP servers unless WiFi is actually connected.
 *  -- Use faster I2C transfers for OLED and FRAM: the earlier WiFi/BT issues seem to have been resolved at some point.
 *  -- Update OLED rows every 35msecs instead of every 50msecs.
 * Version 8.32 2024-01-01
 *  -- Fix Stepper Motor control: was only moving in one direction (v8.31) because of a signed/unsigned math error.
 *  -- Get rid of SSAG_DISCARD_MC_ACKS macro.
 * Version 8.31 2023-12-30
 *  -- Reduce PWM frequency for Dew Heaters from 8192Hz to 4Hz: theoretically more efficient.
 *  -- New "focus.factor" (floating-point) setting for scaling 0..60000 focus motor steps up/down.
 *  -- New "ssag.discard.mc.acks" (bool) setting to reduce Relay traffic with SSAG.
 *  -- Misc tweaks and clean-ups.
 *  -- Enable increasing NVRAM variable count without wiping old saved values.
 * Version 8.30 2023-12-23
 *  -- New "oled" command dumps all OLED displays to Serial/Debug, even when no OLED is wired up.
 *  -- Use .println() instead of .write() for p3000 SERIAL_PRINTLN().
 * Version 8.29 2023-12-21
 *  -- Where possible, eliminate unneeded double<-->int32_t conversions of GPS coordinates.
 *  -- Tweak Nunchuck settings for Celestron Focus Motor speeds.
 *  -- Be even more tolerant of extra spaces in commands.
 *  -- Ensure Factory Reset clears NVRAM only once.
 * Version 8.28 2023-12-19
 *  -- New "simple_mode" of operation: wire 50K pull-down and 100K pull-up on ESP32_WIFI_MODE_PIN.
 *  -- Improve I2C device detection for FRAM modules.
 *  -- Use original floating point lat/lng values for gps.location.lat and gps.location.lng values.
 *  -- Add new "fakegps" command to emulate a GPS receiver:  fakegps dd.dddddd -dd.dddddd
 *  -- Add missing "help" info for the new "send" command.
 *  -- Add new "baud" command to enable setting faster baudrates on the SerialDebug port.
 *  -- Add support for NTP date/time use while GPS waits for date/time fix.
 * Version 8.27 2023-12-17
 *  -- Tighten up command parsing and also make it mostly case-independent, except for single-letter commands.
 *  -- Add new "send" command.  Requires device and at least one (hex) command byte as args. Eg.  send ALT fe
 *  -- Decode/display Evolution battery state when tracing.
 *  -- New 'D' command to toggle discarding of MC ACK responses to SSAG: reduces traffic on Relay bus.
 *  -- Reduce AUXBUS_TXQ_SIZE from 32 to 16; it rarely gets as high as 8; SSAG AutoGuiding may need more than 8.
 *  -- Add routing table: keep track of which devices are on which bus.
 *  -- p3000: Close connection before completing "reset" command.
 *  -- Ethernet: Add Ethernet support to HBG3.  Uses same pins as Stepper Motor, so either/or for those two.
 *  -- Ethernet: Enable more than one client at a time for myDHCP Server.
 * Version 8.26 2023-12-14
 *  -- Bluetooth: Make debug easier: always keep WiFi on when musb.rfenable is 1.
 *  -- Bluetooth: New 'b' command to toggle Bluetooth debug on/off.
 *  -- Bluetooth: Don't forward AUX packets to BT until handshake is completed.
 *  -- Bluetooth: Show BT-Handshake state on OLED and status command.
 *  -- Bluetooth: Add trickery for initial handshake needed by CPWI.
 *  -- Disable both AUX buses and free up their RAM during OTA updates.
 * Version 8.25 2023-12-10
 *  -- Fix Nunchuck to use appropriate speeds when talking to a Celestron Focus Motor vs a local stepper motor.
 * Version 8.24 2023-12-09
 *  -- Make Bluetooth SSID always the same as the WiFi SSID, aka "softap.ssid".
 *  -- OTA: Fix timeout bugs.
 *  -- OLED: Reduce button press timers by 0.5secs to match desired timeouts.
 * Version 8.23 2023-12-07
 *  -- GPS: New NVRAM variable gps.force.saved.location to always use saved lat/lng when no better fix available.
 *  -- GPS: Keep recent GPS Location data when sleeping the GPS, for replay on wake-up (still requires time/date fix).
 *  -- GPS: Increase gps_idle_timeout from 10 minutes to 20 minutes, and allow NVRAM override.
 *  -- GPS: Rename "disable.gps" to "gps.disable" for better consistency.
 *  -- OLED: Show "HBG3 Idle" instead of "No Session".
 *  -- OLED: Show "BT Session" instead of "BT Connected" when link is up but no activity.
 *  -- OLED: On OLED, show ':' after lat/lng for real Location, '?' for saved Location, and '-' for recent Location.
 * Version 8.22 2023-12-02
 *  -- AIO: Show Ethernet status on OLED connection status screen when WiFi is Off.
 *  -- AIO: Fix errors with p3000_debug_ethernet.
 *  -- AIO: Fix hangs when switching ethernet client/server modes.
 *  -- Ensure only char* is used with SERIAL_PRINTLN(), not Strings or QStrings.
 *  -- Implement Push-to-Reset on OLED connection status screen.
 * Version 8.21 2023-12-01
 *  -- Change "Not Connected" to "No Session"
 *  -- Change "W2 Connected" to "WiFi Connected"
 *  -- Change "W3 Connected" to "WiF3 Connected"
 *  -- Change "E2 Connected" to "Eth Connected"
 *  -- Change "E3 Connected" to "Eth3 Connected"
 * Version 8.20 2023-12-01
 *  -- Light up BLUE LED while calibrating a newly plugged-in Nunchuck after boot.
 *  -- New NVRAM variable for "focus.limits"
 *  -- New OLED interface for FOCUS status and setting of FOCUS limits.
 *  -- Don't show GPS on OLED unless detected.
 *  -- Fix factory reset function: wasn't working after v8.19.
 * Version 8.19 2023-11-29
 *  -- OLED: Revamp longpresses (major update).
 *  -- Fix minor bug in new Evo WiFi logic.
 *  -- New 'a' command for toggling whether w2000/bt/musb packets are shown when tracing.
 *  -- By default, show only AUX/Relay packets when tracing.
 * Version 8.18 2023-11-27
 *  -- Handle aborted AUX messages where 0x3b reappears within first 4-bytes.
 *  -- Don't forward incomplete (pkt_fail) packets.
 *  -- OTA:  Fix ota.version.path retrieval from NVRAM.
 *  -- OTA:  Improve version checking.
 *  -- SSAG: Fix decoding of MC replies to SSAG.
 *  -- DEW: Be much more aggressive in "Auto" mode.
 *  -- DEW: Make longpress on Dew-OLED cycle through manual PWM as well as Auto aggressions.
 *  -- DEW: Save "automode" and "manual PWM" settings in NVRAM.
 *  -- DEW: Enable use of manual PWM for channels without thermistors.
 * Version 8.17 2023-11-24
 *  -- Only do EVO WiFi commands if Evo mount detected, and retry if no ACK is received.
 * Version 8.16 2023-11-23
 *  -- Add NMEA_playback feature for debugging/fixing GPS NMEA decoding.
 *  -- Fix two bugs in the NMEA parsing, which were preventing a "fix" from being reported with some GPS modules.
 * Version 8.15 2023-11-21
 *  -- Try and fix garbage on Serial port at boot time.
 *  -- Improve the polling fix from 8.14.
 *  -- OLED: Add GPS Location Save/Restore options.
 *  -- OLED: Other improvements.
 * Version 8.14 2023-11-16
 *  -- AIO: mirror the BLUE LED onto both of the AIO LEDs, as the BLUE LED is normally hidden inside the case.
 *  -- Limit the polling frequency for detecting a Celestron Focus Motor.
 * Version 8.13 2023-10-20
 *  -- For non-AIO, don't do oled_setup() until after reading OLED type from NVRAM.
 * Version 8.12 2023-10-19
 *  -- Turn OLED on before aio_setup(), for much earlier feedback after power-on.
 *  -- Show BT AUX/USB mode on OLED.
 *  -- Fix bugs and clean-up Bluetooth state management.
 * Version 8.11 2023-10-14
 *  -- Include VERSION_DATE as part of OTA Update version check.
 *  -- Verify that single-letter commands are actually single-letters!
 *  -- New "test_auxbus" command, to verify BUSYIN/BUSYOUT and TX/RX functionality.
 * Version 8.10 2023-10-11
 *  -- Push and hold button for 10-seconds while on QRcode screen, and device resets to "factory defaults".
 *  -- Add '*' indicator on DirectConnect display to indicate AccessPoint mode selected but not configured.
 *  -- Move call to aio_setup() to AFTER oled_setup(), so that the AIO's OLED lights up MUCH sooner at power-on.
 * Version 8.9 2023-10-09
 *  -- Note that OTA Updates will NOT work on ethernet because of limitations of the underlying library.
 *  -- Get ethernet working on AIO, including with p3000_debug.
 *  -- Get bt_mode_usb working on AIO: Celestron USB Hand-Controller gets exported over Bluetooth.
 *  -- Tidying.
 * Version 8.8 2023-10-05
 *  -- NCHK: Improve Nunchuck/focuser fix from v8.7, by NOT sending DEV_AZM/DEV_ALT packets out on relay bus.
 *  -- Add PIN definitions for coolick PCBs.
 * Version 8.7 2023-09-19
 *  -- NCHK: Send Nunchuck focuser (and other) packets out on relay bus as well as auxbus.
 * Version 8.6 2023-09-18
 *  -- OLED: Use NVRAM setting "oled.type" instead of a build-time setting.
 *  -- OLED: Use longer I2C bursts for QRcode image data.
 *  -- OLED: Show QRcode only on Adafruit128x64 displays.
 *  -- OTA:  Do SPIFFS partition size check MUCH earlier, so a bad result can be shown on OLED.
 * Version 8.5 2023-09-17
 *  -- OTA:  Implement a better version check; ota.timestamp conflicted with manual Arduino uploads.
 *  -- OLED: Add QRcode splash screen.
 * Version 8.4 2023-09-16
 *  -- OLED: Fix slightly messed-up formatting from v8.3.
 * Version 8.3 2023-09-16
 *  -- DEW: Retain "aggression" values using NVRAM.
 *  -- DEW: Be much more assertive with PWM percentages.
 *  -- DEW: Use degrees rather than half-degrees for "aggression" values.
 *  -- "get all" now shows variables sorted in order by name.
 *  -- New option to support hardware from the original WIFI+BT+GPS project.
 *  -- Support building for All-In-One hardware with HBG3 mainline code: everything working except USB-Host and Ethernet.
 *  -- Add NVRAM setting "musb.rfenable": set to 1 to leave WiFi+BT "on" when musb_selected: needed for port 3000 "debug".
 *  -- Add "status" command to show similar information to what OLED shows.
 *  -- Experiment with 8N1 instead of 8N2 for auxbus, with new NVRAM setting "auxbus.stopbits".
 * Version 8.2 2023-09-13
 *  -- OTA:   Fix bug when scanning for Content-Length header line.
 *  -- OTA:   Compare file timestamp against saved (nvram) timestamp to decide if already up-to-date or not.
 *  -- NVRAM: New NVRAM setting for suppress.lowbattery: Use '1' to block Evolution Low-Battery warnings.
 *  -- NVRAM: New NVRAM settings for OTA update server and path.
 *  -- NVRAM: Change mount.reversed.alt to a simple 0/1 setting instead of "Yes".
 * Version 8.1 2023-09-13
 *  -- P3000: Use w3000.printf() instead of unnecessary w3000_printf().
 *  -- OTA:   Introduce new Over-The-Air (OTA) firmware updates.
 * Version 8.0 2023-09-13
 *  -- P3000: Toggle serial-debug redirection onto WiFi port 3000 with "debug" command there.
 *  -- MUSB:  Make changing the MUSB switch position trigger a reset of the HBG3 after a short delay.
 * Version 7.19 2023-09-11
 *  -- MUSB: Fix it -- wasn't always working with latest CPWI.
 *  -- MUSB: Permit MUSB even when RELAY mode is also active.
 *  -- MUSB: Get rid of "RF-Kill" mode: Wireless always stays off when MUSB switch is active at power-on/reset.
 *  -- MUSB: Get rid of MUSB_ENABLED flag: always enabled in the code now.
 *  -- MUSB: Get rid of FALLBACK serial logic: no SerialDebug if MUSB is "on" and either EMULATE_GPS=true or auxrelay_detected=true
 * Version 7.18 2023-09-09
 *  -- RELAY: Don't do auxrelay_ssforward when controlled from CPWI/SkyPortal/SkySafari.
 * Version 7.17 2023-09-09
 *  -- RELAY: Don't forward emulated-dev requests to auxrelay: fixes emulated-dev double response bug.
 *  -- RELAY: Auto-detect and dynamically manage the need for auxrelay_ssforward instead of a manual NVRAM setting.
 * Version 7.16 2023-09-07
 *  -- GPS:  Improve/speed-up autobaud code.
 *  -- DEW:  Fix build for EMULATE_DEW=false
 * Version 7.15 2023-09-05
 *  -- GPS:  Always wait at least 10-minutes before powering-down GPS.
 *  -- GPS:  Improve autobaud detection: wasn't reliable before.
 *  -- SSAG: Emulate more SSAG commands.
 *  -- SSAG: Decode SSAG commands.
 *  -- Fix issues with "txq->is_alive" causing packets to be discarded.
 * Version 7.14 2023-09-04
 *  -- Fix off-by-one error in packet_decoder(), which was giving "bad len 0xd" messages.
 * Version 7.13 2023-08-29
 *  -- Show emulated device (eg. "gps_rx") instead of "emdev_rx" when tracing.
 *  -- RELAY:  txq->busy_timeout was too short (1.25 seconds); increased it to 15.00 seconds.
 *             Reason is StarSense-HC sometimes holds BUSY while doing plate solve.. takes it a while..
 *  -- RELAY:  Replace build-time variable SSFORWARD_ENABLED with NVRAM variable relay.ssforward (1=on, 0=off).
 *  -- RELAY:  Fix SSFORWARD_ENABLED; was broken by recent memory-saving tweaks.
 *  -- NCHUCK: Slower slewing by default; use 'Z' button for original "faster" slewing.
 *  -- NCHUCK: Slight tweaks to make speed zone '4' a bit wider on the Nunchucks.
 *  -- SSAA:   Emulator tweaks.
 * Version 7.12 2023-08-24
 *  -- Workarounds for CPWI sending bad MC_GOTO_DONE commands.
 *  -- Improve focus_debug output.
 * Version 7.11 2023-08-23
 *  -- Reduce bt_is_active timeout from 15 to 10 seconds.
 *  -- Show 0x3c packet data when using "trace ssaa".
 *  -- Use "HBG3" instead of "HomeBrew" in most places.
 *  -- If auxrelay_detected, then Use 'r' instead of 'v' prefix in VERSION everywhere.
 *  -- Disable Dew Control if auxrelay is detected (pin conflicts).
 *  -- Tidy up auxtest output, and better align print_packet() output.
 *  -- Tweak/speed-up auxrelay detection logic.
 *  -- Rename "auxrelay_[rt]x" to "relay_[rt]x" for print_packet() output.
 * Version 7.10 2023-08-22
 *  -- Allow settling time before loopback existence test for auxrelay bus
 *  -- Give Relay devices a different bus address than regular HBG3: makes testing easier.
 *  -- Split DEV_ESP32 into DEV_HBG3 and DEV_RELAY.
 *  -- Show degrees for MC_GET_POS and CORDWRAP commands.
 * Version 7.9 2023-08-19
 *  -- New NVRAM setting for "cordwrap.override" to override hand-controller, CPWI, etc.  0/1 forces OFF/ON, blank does nothing.
 *  -- Workaround for CPWI sending bad MC_POLL_CORDWRAP commands.
 *  -- Change MC CORDWRAP opcode names to match the AUX Protocol document.
 *  -- Implement push-and-hold for OLED_MODE button to cycle DewControl "aggression" values for channel-0.
 *  -- GPS: New NVRAM setting for "disable.gps": leaves built-in GPS running, but not responding on AUX bus.
 *  -- GPS: emulate the GPS_GET_RCVR_STATUS command.
 * Version 7.8 2023-08-18
 *  -- Tidy up MUSB/RF-Kill status on OLED.
 *  -- Get rid of setTxBufferSize() calls: default buffering is adequate.
 *  -- Enforce full blocking of packets from DEV_CFM.
 *  -- Reduce AUXBUS_PKT_MAX to 16 from 32, matching reality and using considerably less RAM.
 * Version 7.7 2023-08-01
 *  -- FIX BUG: earlier v7.x versions didn't format checksum correctly in responses from emulated devices.
 *  -- Don't allocate large buffer for SSAA emulator until needed, and free it again after.
 *  -- Further reduce AUXBUS_SSAA_PKT_MAX to 848: matters only for the SSAA emulator, which never exceeds 832.
 *  -- Show more informaion from "free" command.
 * Version 7.6 2023-07-31
 *  -- Fix WiFi Direct Connect: system was out of RAM: reduced uart buffers and other stuff.
 *  -- Added "free" command to show heap free memory.
 * Version 7.5 2023-07-31
 *  -- Fix #include of ADC_LUT.h
 * Version 7.4 2023-07-31
 *  -- Fix bug with flipping MUSB switch after power-on.
 * Version 7.3 2023-07-31
 *  -- Lots of code tidying.
 *  -- Fixes for "mount.reversed.alt" mode.
 *  -- Get rid of AUXRELAY_ENABLED flag: auto-detect auxrelay Rx/Tx loopback during setup().
 *  -- FOCUS: Build for both stepper motor DRIVER types, and auto-detect them during setup().
 *  -- Fix bug in "trace" command: "trace" with no dev should turn tracing off!
 *  -- Fix bug in Nexstar GPS compatibility code.
 * Version 7.2 2023-07-29
 *  -- Restore mysterious I2C handshake for Nunchuck: needed by some it seems.
 * Version 7.1 2023-07-29
 *  -- Fix value parsing bug in "set" command; trim this change log.
 * Version 7.0 2023-07-29
 *  -- Implement "mount.reversed.alt" mode, for folks who want to mount their OTA backwards on an ALT/AZM mount.
 *  -- FOCUS: Maintain current stepper position in FRAM (if present), so motor position is remembered across resets and power cycles.
 *  -- DEW:  Use NVRAM for dew_max_amperage[] values: default is 1.8amps, but user can customize it with "set" commands.
 *  -- NCHK: Show samples in nchuck_measure_middle() if nchuck_debug==1
 * Version 6.29 2023-07-28
 *  -- Fix AUXRELAY operation: broken since v6.2 came out.
 *  -- FRAM:  Preliminary support for FRAM modules.
 *  -- NVRAM: Don't display "reservedNN" variables from "get all" command.
 *  -- NCHK:  Tweak slowest slew speed for easier use at the scope.
 * Version 6.28 2023-07-28
 *  -- Fix bug in the "set" command: NUL-terminate the string before saving.
 *  -- Fix bug in "FOCUS IS_CALIBRATED" debug message: was showing opposite of actual value.
 *  -- Misc tweaks to wifi_relay_mode, including making the blink-blink-blink work over the relay.
 * Version 6.27 2023-07-21
 *  -- Doh! Fix auxtest (the 3 blue blinks).
 *  -- Move remaining non-wifi function calls from loop() over to non_wifi_loop().
 *  -- Rename various functions for better consistency.
 * Version 6.26 2023-07-19
 *  -- Use Serial.flush() more often to ensure debug messages get ouput in a timely fashion.
 *  -- Other useful tweaks and tidying.
 *  -- Use auxbus.txq rather than a special queue just for DEV_ESP32.
 *  -- OLED:  Faster screen updates.
 *  -- FOCUS: Increase MUSB timeouts: CPWI-2.5.2 takes longer to connect than earlier versions.
 *  -- FOCUS: Fix handling of CALIBRATION_ENABLE, based on how Focuser Utility uses it.
 *  -- FOCUS: Fix MUSB for standalone focuser/dew use.
 *  -- MUSB:  Standalone Focus Motor now works again.
 *  -- Detect when BUSYIN is stuck LOW, and discard packets rather than having the queue get stuck.
 * Version 6.25 2023-07-19
 *  -- Make WiFi AccessPoint (client) mode compatible with older APs, and with Open APs (no passkey).
 *  -- Replace esp32_msg with esp32_msgs[] queue, to handle more than one request queued up.
 *  -- FOCUS: Add failsafe STOP because FastAccelStepper sometimes doesn't stop when told.
 * Version 6.24 2023-07-18
 *  -- FOCUS: Fixed. Had return values swapped in focus_handle_request() in v6.23.
 * Version 6.23
 *  -- BUGFIX: Stop calling w2000.flush(): messes up CPWI over WiFi.
 *  -- Get rid of the "UDP Broadcast" messages on Serial port.
 *  -- Split and tidy the bus_tx() and claim_bus_for_tx() logic.
 *  -- Tighten up StarSense packet handling/forwarding logic.
 *  -- Consolidate 0x3b packet checksum calculations.
 *  -- Simplify a lot of little things from earlier days.
 * Version 6.22 2023-07-17
 *  -- BUGFIX: Tail end of Starsense packets were not being forwarded over WiFi/BT/USB. Fixed. 
 *  -- Tighten up Starsense parsing: don't tolerate 0x3b inside Starsense header; reset sspadding=0 for each new packet.
 *  -- NVRAM:  Prefix nvram related globals with nvram_
 *  -- DEW:    Prefix dew control related globals with dew_
 *  -- DEW:    Rename DEWCONTROL_/dewcontrol_ globals to DEW_/dew_ everywhere.
 *  -- FOCUS:  Prefix focus motor related functions/vars with focus_
 *  -- FOCUS:  Rename FM_/fm_ globals to FOCUS_/focus_ everywhere.
 *  -- Misc tweaks and tidying.
 * Version 6.21 2023-07-17
 *  -- DEW:    Fix GET_VERSION so DEW works. Broken in v6.20.
 * Version 6.20 2023-07-17
 *  -- Misc tweaks and tidying.
 *  -- BUGFIX: Fully parse Starsense packets from AUX, fixing bugs from older versions of the parser.
 *  -- BUGFIX: Ensure auxbus rxBufferSize is large enough for any size StarSense Camera image packet.
 *  -- FOCUS:  Maintain calibration status in NVRAM. Someday use FRAM for saving the calibrated limits and motor position.
 *  -- SSAG    Enable/disable emulation via NVRAM variable.
 *  -- SSAA    Enable/disable emulation via NVRAM variable.
 *  -- SSAA:   Randomly generate plates.
 *  -- SSAA:   Merge/improve the SSAA Camera Simulator code. 
 *  -- SERIAL: Replace t1/t2 commands with "trace".  Only one device can be traced at a time now.
 * Version 6.19 2023-07-15
 *  -- Various minor tweaks and tidying in places.
 *  -- New auxbus_passive_mode toggle for listen-only monitoring of AUX bus (for reverse engineering CFM).
 *  -- Handle baud-rate changes for device 0x00.
 *  -- SERIAL: Implement $$$ ASCII Passthru mode to Celestron WiFi configuration port.
 *  -- SERIAL: Decode device names and most opcodes for print_packet() tracing.
 *  -- SERIAL: New commands 't1', 't2', and 'devs' to set tracing of one or two specific AUX devices.
 *  -- DEW:   Don't emulate Celestron DewController unless SHT3x was detected (was broken for a few releases).
 *  -- GPS:   Don't show messages unless 'g' is toggled on.
 *  -- GPS:   New serial command 'G' to toggle display of GPS NMEA sentences on/off.
 *  -- MUSB:  Show baud rate 115201 as 115200 on the OLED.
 *  -- MUSB:  Improve initial handshake for CPWI.
 *  -- MUSB:  New 'M' command for MUSB timestamps per byte.
 *  -- FOCUS: Use 0..60000 as the full focus range, centred on 30000, same as Celestron does.
 * Version 6.18 2023-07-12
 *  -- Fix standalone operation (no AUX connection) to work with CPWI and the Focuser Utility.
 *  -- Fix many things so that the Serial debug stuff can work outside of the Arduino Serial Monitor.
 *  -- MUSB:  Added 'm' command for the new musb_debug toggle.
 *  -- MUSB:  Default baud rate now 19200 (same as other Celestron devices), with auto-baud shifting to 115200 for CPWI.
 *  -- NCHK:  Only one (X/Y) axis at a time when focus_selected.
 *  -- SSAG:  Added option to pretend to be an SSAG, to make the hand-controller SSAG menu appear, but with NO functionality.
 *  -- FOCUS: Make focus.microsteps configurable in NVRAM.
 *  -- FOCUS: Enable finer focusing speeds from Nunchuck than from HC/CPWI/Utility.
 *  -- FOCUS: Rewrite ULN2003 driver support to use moveTo() for everything.
 *  -- FOCUS: Switch to FastAccelStepper library for STEP/DIR motor driver chips.
 * Version 6.17 2023-07-10
 *   -- Make port-3000 commands also available from the serial interface.
 *   -- Implement a long-overdue "help" command.
 *   -- FOCUS: Define stepper motors according to the driver chip rather than motor model number.
 *   -- FOCUS: Change how stepper motors are stopped, so that the AccelStepper library doesn't get confused.
 *   -- FOCUS: New serial command 'S' to set experimental fm_maxspeed values for testing.
 *   -- NCHK:  Reduce middle-measuring time from 1.5secs to 0.75secs for faster start-up. 
 * Version 6.16 2023-07-08
 *   -- FOCUS: Fix standalone mode by preventing testmsg's from clogging txq when mount is off or not attached.
 *   -- FOCUS: Lots of changes to how the stepper motors are managed.
 *   -- FOCUS: Implement Celestron backlash compensation.
 *   -- Lots of tidying everywhere.
 * Version 6.15 2023-07-07
 *   -- FOCUS: New serial 'f' command for toggling focus_debug.
 *   -- FOCUS: Support different models of stepper motors.
 *   -- FOCUS: Fix "go to preset": was broken in last couple of updates.
 *   -- MUSB:  Replace MOUNTUSB_* with MUSB_* everywhere to fix MUSB and avoid future Mount-USB bugs.
 *   -- NCHK:  Replace NUNCHUCK_* with NCHUCK_* everywhere to avoid future Nunchuck bugs.
 * Version 6.14 2023-07-06
 *   -- FOCUS: Merged working stepper motor implementation, courtesy of Andriy Melnykov.
 *   -- MUSB:  Fix operation with emulated devices (GPS, DEW, FOCUS) over the HBG3 USB connection.
 * Version 6.13 2023-07-03
 *   -- Misc:  Stop (failed) auxtest attempts after 15-seconds.
 *   -- NCHK:  Hold both buttons for 2-secs to toggle between focus-only and slew/focus modes.
 *   -- FOCUS: Enable use of Nunchuck with EMULATE_FOCUS.
 *   -- FOCUS: Improve (fake motor) emulation by keeping track of stepper_position and stepper_speed.
 * Version 6.12 2023-07-01
 *   -- DEW: Tidy ups, minor fixes, implement opcode 0x03.
 *   -- DEW: Added 'd' toggle for dew_debug.
 * Version 6.11 2023-06-30
 *   -- OLED: The OLED "mode switch" is now assumed to be present when OLED_ENABLED is true.
 *   -- FOC:  Include code for emulation of a Celestron Focus Motor.
 *   -- DEW:  First release of emulation of Celestron 2X Smart Dew Heater Controller.
 * Version 6.10 2023-06-26
 *  -- WIFI: Make the WiFi-Relay "automatic" when connecting as client to Celestron-* or HomeBrew-*.
 *  -- OLED: Fix SSID/IP displays for Client and Relay modes.
 * Version 6.9 2023-06-26
 *  -- WIFI: Implemented WiFi-Relay: a pair of devices act as a WiFi AUX bridge without wires.
 *  -- OLED: Tidy up the top line of the connections display screen.
 *  -- OLED: Ensure screen is updated while waiting for connect in Access Point (client) mode.
 * Version 6.8 2023-06-22
 *  -- OLED: Fix the font for 128x64 displays, by cloning System5x7 and doubling it in height only.
 *  -- OLED: Change default display type to the now-common 0.96" 124x64 type instead of 128x32.
 * Version 6.7 2023-06-21
 *  -- GPS: Inv2023-06-15alidate fields if not updated within past 15 seconds.
 *  -- GPS: Return date/time when valid, even if GPS fix not yet obtained.
 *  -- GPS: Improve parsing/validation of date/time fields.
 * Version 6.6 2023-06-15
 *  -- Added '#'/';' (comment) commands for annotating serial port output.
 *  -- Added 'r' (raw) command for tracing of raw AUX port comms.
 *  -- Display serial monitor message when formatting SPIFFS.
 *  -- Stop attempting the BLUE-BLINK test after 12secs when STANDALONE_FOCUS_CONTROL is true.
 *  -- NCHK: Include focus presets in nvram even when NUNCHUCK_FOCUS_ONLY is false.
 * Version 6.5 2023-05-31
 *  -- NCHK: Maintain Focus Motor presets in nvram.
 *  -- NCHK: Re-use original approach direction for presets, automatically accounting for any backlash.
 *  -- NCHK: Remove support for Focus Motor Calibration limits: the motor firmware handles it automatically.
 * Version 6.4 2023-05-31
 *  -- NCHK: Support query/use of Celestron Focus Motor Calibration limits.
 *  -- Various minor tweaks and cleanups.
 * Version 6.3 2023-05-29
 *  -- MUSB: Make MUSB switch also act as a BT/WiFi kill switch when "on" (LOW).
 * Version 6.2 2023-05-26
 *  -- NCHK: Remove option for Nunchuck encrypted mode.
 *  -- GPS:  Use HardwareSerial port when MUSB is not selected at boot time.
 *  -- GPS:  Improve accuracy between GPS messages for reported time of day.
 *  -- GPS:  Larger buffer for SoftwareSerial.
 *  -- OLED: Allow GPS to turn off when GPS status isn't being shown.
 *  -- OLED: Don't rewrite unchanged rows, saving I2C overhead: helps GPS SoftwareSerial.
 *  -- DEW:  Improve "bad reading" detection for thermistors.
 * Version 6.1 2023-05-17
 *  -- DEW:  Use floating point math, fix thermistor temperature calculations, add device-specific ADC_LUT[].
 *  -- GPS:  Improve tolerance for corrupted/missed messages to 15 seconds from 3 seconds.
 * Version 6.0 2023-05-14
 *  -- DEW:  Defined pins for a second Dew Control channel.
 *  -- OLED: Really turn off display for the "Display Off" screen.
 *  -- OLED: Miscellaneous fixes and improvements.
 * Version 5.39 2023-05-14
 *  -- OLED: Fix building with OLED_ENABLED but no OLED_MODE_PIN defined
 * Version 5.38 2023-05-13
 *  -- Print HomeBrew banner on Serial before any other messages after boot.
 *  -- I2C:  Use 100000 clock speed for all I2C devices. 400000 was interfering with WiFi/Bluetooth.
 *  -- OLED: Reduce CPU load by only updating one display line at a time.
 *  -- OLED: Delay slightly before scanning I2C bus: might improve OLED detection.
 *  -- OLED: Show a lot more info on the netstatus screen.
 * Version 5.37 2023-05-13
 *  -- DEW:  Fix handling of negative temperatures (below 0C).
 *  -- OLED: Tidy up use of OLED_MODE_PIN and the various display modes.
 *  -- OLED: Show WiFi info on the Network Status screen.
 *  -- DEW:  Always show ambient on OLED, even if no thermistors found.
 * Version 5.36 2023-05-12
 *  -- OLED: Use D4 for OLED_MODE_PIN, because D2 is already in-use for the BLUE LED.
 *  -- OLED: Multiple screen modes, with OLED_MODE_PIN button to cycle amongst them.
 *  -- DEW:  Support max 2 DewControl channels rather than 4 for now.
 *  -- DEW:  Changed DewControl[0] pins from D34,D4 to D34,D14.
 *  -- DEW:  Lots of DewControl changes.
 * Version 5.35 2023-05-11
 *  -- Added Smart Dew Heater Control for up to four channels.
 * Version 5.34 2023-04-24
 *  -- GPS:  Work around bad/varying satellite counts in the "SV" messages from BE-180.
 * Version 5.33 2023-04-24
 *  -- GPS:  Speed up auto-baud so GPS detection finishes before StarSense HC polls for GPS.
 *  -- GPS:  Increase sleep timeouts.
 *  -- GPS:  Fix wake-up of BE-180 GPS after reset.
 *  -- OLED: Show HomeBrew SSID on top line of 128x64 displays.
 *  -- OLED: Fixed bug in "Don't sleep the GPS when using an OLED".
 * Version 5.32 2023-04-18
 *  -- GPS: Support the Beitian BE-180 and others that use 38400 baud.
 *  -- fixed configuration information output over USB at startup.
 * Version 5.31 2023-04-18
 *  -- GPS:  Fixed under-reporting of Satellites-In-View.
 *  -- OLED: Fixes for more than one type of 128x64 display.
 *  -- OLED: Don't sleep the GPS when using an OLED display.
 * Version 5.30 2023-04-09
 *  -- Nunchuck: Read the calibration data BEFORE using it.  Doh!
 *  -- OLED updates from KenF9000: build-time support for larger 128x64 display.
 * Version 5.29 2023-04-07
 *  -- Nunchuck: Deal with all-zeros calibration data.
 * Version 5.28 2023-03-28
 *  -- Added StarSense-For-SkyWatcher translation support.
 *  -- Added optional OLED support: needs extra libraries when enabled.
 * Version 5.27 2023-02-20
 *  -- Nunchuck: Tidying.
 *  -- Nunchuck: Fixed crash seen sometimes when Nunchuck gets connected.
 * Version 5.26 2023-02-17
 *  -- Nunchuck: Implement 5 slew speeds instead of the previous 4 speeds.
 *  -- Nunchuck: Improve speed range calculations
 *  -- Nunchuck: Shorten "nunchuck_" to "nchuck_" to make the code more digestible. 
 * Version 5.25 2023-02-17
 *  -- Nunchuck: Fix bug from last version where only the highest speed worked with LEFT/DOWN motions.
 *  -- Nunchuck: Do nchuck_request_data() earlier, to give Nunchuck more time to process it.
 *  -- Nunchuck: Use calibration data centres as starting points for measuring centre ranges.
 * Version 5.24 2023-02-16
 *  -- Nunchuck: Use a centre-range rather than a single centre-point for X and Y axis.
 *  -- Nunchuck: Fix BUG where calibration data wasn't being read unless in debug mode. Duh.
 *  -- Fix compilation for GPS_ENABLED=false
 * Version 5.23 2023-02-11
 *  -- Nunchuck: Add new nchuck_debug mode, enable with 'n' in Serial Monitor.
 * Version 5.22 2023-02-10
 *  -- Nunchuck: Fix sign-extension bug in detection code.
 * Version 5.21 2023-02-06
 *  -- Nunchuck: Improve range calculations for cases where calibration min/max are different amounts from centre.
 *  -- Nunchuck: Handle calibration data where min/max are zero but centre point appears to be valid.
 *  -- Nunchuck: Measure actual centre point and redo calculations if it doesn't match the earlier (calibration) values.
 * Version 5.20 2023-02-06
 *  -- Nunchuck: Use calibration data if it appears to be valid.
 * Version 5.19 2023-02-06
 *  -- Handle Nintendo-branded Nunchucks with more limited movement range.
 * Version 5.18 2023-01-13
 *  -- Make it easier to adjust the LED polarity for boards that have it wired differently.
 *  -- Fix SPIFFS error that shows up after initial flashing.
 *  -- Add code to help with testing the MUSB switch on newly assembled modules.
 * Version 5.17 2023-01-08
 *  -- Be smarter when blinking BLUE LED for auxtest.
 * Version 5.16 2023-01-08
 *  -- Support for NUNCHUCK_FOCUS_ONLY with presets for focus.
 * Version 5.15 2023-01-02
 *  -- Fix use of attached GPS with hand-controllers.
 * Version 5.14 2023-01-01
 *  -- Fix compilation for GPS_ENABLED=false
 *  -- Use MUSB switch to select ssforward_enabled when AUXRELAY_ENABLED=true
 * Version 5.13 2022-12-31
 *  -- To better guarantee correct sequencing, handle GPS requests from bus_tx() rather than from packet_decoder().
 *  -- Send AUX messages immediately from tx_enq when queue is empty.
 *  -- Tidy up the auxtest messages.
 * Version 5.12 2022-12-17
 *  -- Improve WiFi connect reliability in client mode.
 *  -- CPWI-2.3.5-beta11 doesn't like fast GPS replies, so slow them down.
 * Version 5.11 2022-12-16
 *  -- Fix bug and crash in GPS code.
 * Version 5.10 2022-12-12
 *  -- Include support for (optional) Nunchuck slew/focus controller.
 * Version 5.9 2022-12-11
 *  -- Restart the BT stack after BT disconnect as workaround for Coexistence bug.
 *  -- Note: WiFi/BT Coexistence bug in ESP32 support causes it to crash after first BT connection.
 *  -- Fix bluetooth: wasn't working reliably.
 *  -- Stop bluetooth after 15-secs of no rx activity.
 *  -- Re-implement handling/relaying of StarSense Camera packets so it works across the Relay.
 *  -- Tidy up auxtest logic.
 * Version 5.8 2022-12-09
 *  -- Fix build error when AUXRELAY is not enabled.
 * Version 5.7 2022-12-09
 *  -- Flush txq on overflow, and for auxrelay test busyin/busyout and disable if not working.
 *  -- Prevent "esp_wifi_get_mac failed!" error when switching to WiFi Server mode.
 *  -- Print sketch configuration at start-up.
 * Version 5.6 2022-12-09
 *  -- Send attached GPS reply back on same bus that the request arrived from.
 *     This enables an attached GPS to override one from the opposite bus.
 * Version 5.5 2022-12-08
 *  -- Prevent re-forwarding packets across the relay; was causing duplicate responses to remote apps.
 *  -- Redo WiFi logic to turn off EVO and ESP32 WiFi when other connections are in use.
 *  -- Reduce a bunch of arbitrary delays, improving performance.
 *  -- Tidy up the GPS code.
 *  -- Rename musb_connected to the more appropriate musb_selected.
 * Version 5.4 2022-12-07
 *  -- Run AUX bus ports at 8N2 again like Celestron does, not 8N1.
 * Version 5.3 2022-12-06
 *  -- Major(!) code revamp.
 *  -- Implement optional auxrelay support.
 *  -- Move GPS to EspSoftwareSerial Library when MOUNTUSB or AUXRELAY are ENABLED, to avoid conflict with HardwareSerial(1).
 *     Note that EspSoftwareSerial Library version 6.16.1 works for me, but 6.17.0 fails to build with ESP32 support 1.0.6.
 * Version 5.2 2022-12-05
 *  -- Change ESP32_WIFI_MODE_PIN from pin-D5 to pin-D13 for convenience of assembly.
 * Version 5.1 2022-12-05
 *  -- Include optional Mount-USB functionality. Ground Pin-D15 before reset to activate Mount-USB instead of GPS.
 *  -- The regular serial debug/command interface moves to the GPS pins when Mount-USB is selected via Pin-D15.
 *     >>> MS-Windows Driver installation is required for the onboard CP210x USB-Serial chip:
 *           Go here:  https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers?tab=downloads
 *           Download/save the CP210x Universal Windows Driver .zip file.
 *           Extract the .zip file.
 *           Right click on the extracted silabser.inf file, and click INSTALL.
 * Version 5.0 2022-12-04
 *  -- Simplify compatibility translation for NexstarGPS mounts.
 *  -- Disconnect w2000 on any attempt by remote to address DEV_00, to prevent CFM from seeing the mount.
 *  -- Enable "version" command by default: needed by CPWI inside VirtualBox.
 *  -- Pull in local hacked/copy of TinyGPS++.  No library is needed now.
 *  -- Change SPIFFS config file name; Add signature to file to recognize new versions.
 *  -- Limit auxtest to four successes.
 *  -- Print entire bad packet when bad csum is seen and verbose=1.
 *  -- Improve handling of WiFi mode switch.
 * Version 4.9 2022-12-02
 *  -- Changed pins for GPS from 22,33 to 33,25 to match the new PCBs.
 *  -- Added continuous AUX test for easier hardware debugging.
 *  -- Removed all remnants of ethernet code, and got rid of BT_ENABLED flag.
 *  -- Get rid of the WiFi "OFF" PINs.
 *  -- Get rid of USE_ORIGINAL_PINS flag and the alternative pin definitions
 *  -- Get rid of RESTORE_DEFAULTS_PIN: nobody knew about it anyway.  :)
 *  -- Always do vars_save() when unable to read vars from flash.
 *  -- General tidying.
 *  -- Trimmed versions earlier than 4.0 from this Changelog.
 * Version 4.8 2022-11-24
 *  -- Bring back the echo-supression from v3.7: needed for old mounts.
 * Version 4.7 2022-11-??
 *  -- Fix broken compatibility for older NexstarGPS mounts.
 * Version 4.6 2022-11-??
 *  -- Speed up GPS Fix times.
 *  -- Note quirk: When configuring AP parameters with SkyPortal, it doesn't even try
 *     to connect to port 3000 unless one has connected/disconnected port 2000 first.
 *     SkyPortal does this even with Celestron's Evolution WiFi.  Instead of trying p3000,
 *     it connects to AUX and sends single byte 0x24 ('$') a few times(?).
 *  -- Fix the port 3000 connection: wasn't working with SkyPortal.
 *  -- Remove the recently-added bt_timeout: spoils one of the benefits of Bluetooth.
 * Version 4.5 2022-11-05
*   -- Note quirk: When configuring AP parameters with SkyPortal, it doesn't even try
 *      to connect to port 3000 unless one has connected/disconnected port 2000 first.
 *      SkyPortal does this even with Celestron's Evolution WiFi.  Instead of trying p3000,
 *      it connects to AUX and sends single byte '24' a few times(?).
 *  -- Fix the port 3000 connection: wasn't working with SkyPortal.
 *  -- Remove the recently-added bt_timeout: spoils one of the benefits of Bluetooth.
 * Version 4.4 2022-10-29
 *  -- For V3 of the Hardware Design.  Works with 6/8 SE mount, Evolution mount, possibly others.
 * Version 4.3 2022-1?-??
 *  -- Fix errant "Starsense" messages.
 * Version 4.2 2022-10-28
 *  -- Minor tweaks; reduce frequency of (verbose) "UDP Broadcast" messages on USB/Serial.
 * Version 4.1 2022-10-??
 *  -- Add new GPS_ENABLED(false) flag to remove TinyGPS++ dependency.
 *  -- Change server netmask to 255.255.255.0 (was .240).
 *  -- Nuke remnants of last_auxbus_tx (dead code).
 *  -- Disable internal pull-up on auxbus RX line when bi-directional level-shifting is used.
 * Version 4.0 2022-10-08
 *  -- option for use of a single bidirectional BUSY line instead of BUSYIN/BUSYOUT.
 *  -- use unsigned type for "cx" rather than char.
 *  -- reset cx to zero on "exit" command.
 *  -- use safer nvram_get_val() instead of find_val() most places.
 * Version 3.7 2021-05-08
 *  -- Receive/discard echos of packets we send to auxbus, instead of trying auxbus.flush().
 *  -- NexstarGPS: emulate responses for MC_GET_MAX_RATE, MC_GET_MAX_SLEW_RATE command from CPWI.
 * Version 3.6 2021-04-25
 *  -- Fix false detection of non-existing GPS receivers.
 *  -- Add 'g' command to toggle GPS debugging
 * Version 3.5 2021-04-20
 *  -- Reinstate 15-second connection timeout for recovery from wifi drops.
 *  -- Added automatic management of EVO WiFi as alternative to having a switch for it.
 *  -- More code refactoring to enable use of W5500 ethernet eventually.
 *  -- For Nexstar-GPS mounts, emulate a CPC mount instead.
 *  -- New pin assignments going forward, to eliminate conflicts with SPI/I2C.
 * Version 3.4 2021-03-13
 *  -- Doh. Fix bug in GPS-8 compatibility code.
 *  -- Fix corner cases for the new buffering.
 * Version 3.3 2021-03-13
 *  -- Implemented buffering of non-0x3b pkt data bytes for WiFi/BT transmission.
 *  -- Fixed harmless (?) bug with Starsense 0x3c data handling.
 *  -- Work on compatibility for older mounts such as the GPS-8.
 * Version 3.2 2021-03-13
 *  -- Fix BT SSID generation, and tidy up WiFi mac access/use everywhere.
 * Version 3.1 2021-03-12
 *  -- Revamp w2000/w3000 handling using globals for WiFiClient objects.
 *  -- Get rid of auxbus_over_usbserial: nobody wants/uses it.
 *  -- Lots of code revamping/tidying.
 * Version 3.0 2021-03-12
 *  -- Remove StarSense Simulator: no longer needed.
 *  -- use "#if BT_ENABLED" instead of "if (BT_ENABLED)"
 * Version 2.9
 *  -- Code cleanups and some restructuring.
 * Version 2.8a 2021-03-01
 *  -- Increased time BUSY is asserted before ESP32 begins transmitting.
 * Version 2.8 2021-02-24
 *  -- Add a hyphen into the BT_ID.
 *  -- Add StarSense Camera Simulator
 *  -- Apply various fixes to make WiFi+BT work with StarSense Camera
 * Version 2.7
 *  -- Enable Bluetooth (BT) by default: it works(!) with CPWI.
 *  -- Generate unique BT id based on WiFi hardware mac address.
 * Version 2.6 2021-02-09
 *  -- Update auxbus_receive() to better handle StarSense Camera 0x3c packets.
 * Version 2.5
 *  -- Allow for arbitrary auxbus protocols and arbitrary auxbus message sizes.
 * Version 2.4
 *  -- Allow for auxbus messages with up to the protocol limit of 256 bytes payload
 *  -- Get rid of unnecessary rxbuf->count field.
 * Version 2.3
 *  -- Fix GPS pin confusion and add an explanation.
 * Version 2.2 2021-01-06
 *  -- Move VERSION to the end of the WIFI_VERSION string.  Print it at startup.
 *  -- Change BUSYOUT-to-tx delay to 100 microseconds.
 *  -- Get rid of the verbose=0/1 messages.
 * Version 2.1c 2021-01-05
 *  -- New usbserial commands: 't' send test msg; 'v' toggle verbose.
 *  -- Add BUSY diagnostics when verbose=1.
 *  -- Increase BUSYOUT-to-tx delay to 500 microseconds.
 * Version 2.1a 2021-01-04
 *  -- Add rudimentary auxbus test.
 * Version 2.1 2021-01-04
 *  -- Fix LED so that it is only on when there's a WiFi connection.
 *  -- Fix parser error on p3000.
 * Version 2.0 2021-01-04
 *  -- Get rid of wifi timeouts: don't seem to be needed after all.
 *  -- Disable Bluetooth by default.
 *  -- Prepend millisecond timestamps to print_packet() output.
 *  -- Replace BUILD_BT flag with BT_ENABLED flag
 *  -- Fixed code use VERBOSE again.
 *  -- Tidying.
 * Version 1.9
 *  -- Make changes to the WiFi mode immediate, both from vars and the physical switch.
 *  -- In the event that the Client parameters are incomplete, it will revert to SoftAP
 *      mode until new vars are "saved".
 * Version 1.8
 *  -- Implemented auxbus_over_usbserial.  Pull pin-19 LOW at startup to activate it.
 *      In theory, this allows for use of MCupdate over the USB-Serial connection.
 *  -- Remap hardware-serial-0 to the GPS, and hardware-serial-1 to USB.
 *      This gets rid of spurious debug messages from Arduino libraries that might mess up auxbus_over_usbserial.
 *  -- Reset the wifi_rxbuf on new connection.
 *  -- Added a (disabled) "version" command on port 3000, same as Celestron.  Enables CFM to detect us.
 * Version 1.7
 *  -- Try to arrange wifi code more sensibly.
 *  -- Added a "verbose" variable on port 3000.
 *  -- Use a (likely) unique default SSID which includes the final 6-digits of MAC.
 *  -- Corrected Pin-D5 to Pin-5 everywhere.
 *  -- Added wifi "reset" command on port 3000.
 *  -- Tidying.
 * Version 1.6 2020-12-28
 *  -- Implemented port 3000 management interface.
 *  -- Implemented get/set for all variables used by SkyPortal.
 *  -- Save/restore variables in flash memory.
 *  -- Implemented WiFi-client mode, using config from wlan variables.
 *  -- Designated Pin-18 for use as "restore defaults" in case of misconfiguration.
 *  -- Designated Pin-5 for WiFi mode switch.
 *  -- Added a variable for "wifi.mode": 0=SoftAP, 1=Client, anything else uses the Pin-5 switch.
 *  -- Don't report GPS capability until after a GPSr is detected on its serial port.
 * Version 1.5
 *  -- Reconfigured the board definition to use "huge_app" partitions layout.
 *  -- General tidying.
 * Version 1.4 2020-12-26
 *  -- Added working BlueTooth serial support!
 *  -- Not enough flash memory on the ESP32 to hold everything at once though.
 *  -- Need to select BUILD_* features at compile time now.
 * Version 1.3 2020-12-26
 *  -- SkyPortal app now connects instantly! 
 *  -- Added UDP advertisement broadcasts.
 *  -- Added NULL responses to timed-out "GET_VER" queries.
 *  -- Added TCP KEEPALIVE packets at 2000msec intervals.
 * Version 1.2 2020-12-19
 *  -- General tidying.
 *  -- Added WiFi on/off switch for ESP32 wifi, using GPIO15 pin.
 *  -- Added WiFi on/off switch for internal EVO wifi, using GPIO4/D4 pin.
 * Version 1.1 2020-12-15
 *  -- Added WiFi killswitch on GPIO15, for GPS-only use.
 * Version 1.0 2020-12-??
 *  -- Initial release.
 *       GPS+WiFi are both working well. Bluetooth (BT) not yet implemented.
 *  -- SkyPortal has a longish delay at startup with the WiFi (be patient).
 *       This is mainly due to SkyPortal polling for StarSense and Focuser.
 *       The Celestron Wifi responds after 100msec with an empty TCP packet,
 *       and I have yet to figure out how to get the ESP32 to do the same.
 *  -- Shorter TCP timeouts not yet implemented; might not be necessary.
 *  -- Wiring schematic not yet drawn up, but circuit uses a 74HC125 for interfacing.