* bug #4184: fix config file loss due to filesystem write errors
* Use SafeFile for atomic file writing (with xor checksum readback)
* Write db.proto last because it could be the largest file on the FS (and less critical)
* Don't keep a tmp file around while writing db.proto (because too big to fit two files in the filesystem)
* generate a new critial fault if we encounter errors writing to flash
either CriticalErrorCode_FLASH_CORRUPTION_RECOVERABLE or CriticalErrorCode_FLASH_CORRUPTION_UNRECOVERABLE
(depending on if the second write attempt worked)
* reformat the filesystem if we detect it is corrupted (then rewrite our config files) (only on nrf52 - not sure
yet if we should bother on ESP32)
* If we have to format the FS, make sure to preserve the oem.proto if it exists
* add logLegacy() so old C code in libs can log via our logging
* move filesList() to a better location (used only in developer builds)
* Reformat with "trunk fmt" to match our coding conventions
* for #4395: don't use .exists() to before attempting file open
If a LFS filesystem is corrupted, .exists() can fail when a mere .open()
attempt would have succeeded. Therefore better to do the .open() in hopes that
we can read the file (in case we need to reformat to fix the FS).
(Seen and confirmed in stress testing)
* for #4395 more fixes, see below for details:
* check for LFS assertion failures during file operations (needs customized lfs_util.h to provide suitable hooks)
* Remove fsCheck() because checking filesystem by writing to it is very high risk, it makes likelyhood that we will
be able to read the config protobufs quite low.
* Update the LFS inside of adafruitnrf52 to 1.7.2 (from their old 1.6.1) to get the following fix:
97d8d5e96a
* use disable_adafruit_usb.py now that we are (temporarily?) using a forked adafruit lib
We need to reach inside the adafruit project and turn off USE_TINYUSB, just doing that
from platformio.ini is no longer sufficient.
Tested on a wio-sdk-wm1110 board (which is the only board that had this problem)
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
There are no calls to the functions defined in Nimble from this
class. See also older comment on line 8 about the dream to seperate
mesh and bluetooth :)
* Add "Scan and Select" input method for canned messages
* Adapt canned message drawing if USE_EINK
* Indicate current selection with indent rather than inverse text
* Avoid large text on "sending" and delivery report pop-ups
* Fit SNR and RSSI details on screen
* Change hash function which detects changes in E-Ink images
The old function struggled to distingush between images on the canned-message frame, failing to update when scrolling between messages. No real justification for the new algorithm, other than "it works" and doesn't seem "too expensive". For context, this function runs once a second.
* Use canned messages (scan and select) by default with HT-VME213 and HT-VME290
* Guard for HAS_SCREEN
* Use SafeFile for atomic file writing (with xor checksum readback)
* Write db.proto last because it could be the largest file on the FS (and less critical)
* Don't keep a tmp file around while writing db.proto (because too big to fit two files in the filesystem)
* generate a new critial fault if we encounter errors writing to flash
either CriticalErrorCode_FLASH_CORRUPTION_RECOVERABLE or CriticalErrorCode_FLASH_CORRUPTION_UNRECOVERABLE
(depending on if the second write attempt worked)
* reformat the filesystem if we detect it is corrupted (then rewrite our config files) (only on nrf52 - not sure
yet if we should bother on ESP32)
* If we have to format the FS, make sure to preserve the oem.proto if it exists
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Turn off vscode cmake prompt - we don't use cmake on meshtastic
* Add rak4631_dap variant for debugging with NanoDAP debug probe device.
* The rak device can also run freertos (which is underneath nrf52 arduino)
* Add semihosting support for nrf52840 devices
Initial platformio.ini file only supports rak4630
Default to non TCP for the semihosting log output for now...
Fixes https://github.com/meshtastic/firmware/issues/4135
* powermon WIP (for https://github.com/meshtastic/firmware/issues/4136 )
* oops - mean't to mark the _dbg variant as an 'extra' board.
* powermon wip
* Make serial port on wio-sdk-wm1110 board work
By disabling the (inaccessible) adafruit USB
* Instrument (radiolib only for now) lora for powermon
per https://github.com/meshtastic/firmware/issues/4136
* powermon gps support
https://github.com/meshtastic/firmware/issues/4136
* Add CPU deep and light sleep powermon states
https://github.com/meshtastic/firmware/issues/4136
* Change the board/swversion bootstring so it is a new "structured" log msg.
* powermon wip
* add example script for getting esp S3 debugging working
Not yet used but I didn't want these nasty tricks to get lost yet.
* Add PowerMon reporting for screen and bluetooth pwr.
* make power.powermon_enables config setting work.
* update to latest protobufs
* fix bogus shellcheck warning
* make powermon optional (but default enabled because tiny and no runtime impact)
* tell vscode, if formatting, use whatever our trunk formatter wants
without this flag if the user has set some other formatter (clang)
in their user level settings, it will be looking in the wrong directory
for the clang options (we want the options in .trunk/clang)
Note: formatOnSave is true in master, which means a bunch of our older
files are non compliant and if you edit them it will generate lots of
formatting related diffs. I guess I'll start letting that happen with
my future commits ;-).
* add PowerStress module
* nrf52 arduino is built upon freertos, so let platformio debug it
* don't accidentally try to Segger ICE if we are using another ICE
* clean up RedirectablePrint::log so it doesn't have three very different implementations inline.
* remove NoopPrint - it is no longer needed
* when talking to API clients via serial, don't turn off log msgs instead encapsuate them
* fix the build - would loop forever if there were no files to send
* don't use Segger code if not talking to a Segger debugger
* when encapsulating logs, make sure the strings always has nul terminators
* nrf52 soft device will watchdog if you use ICE while BT on...
so have debugger disable bluetooth.
* Important to not print debug messages while writing to the toPhone scratch buffer
* don't include newlines if encapsulating log records as protobufs
* update to latest protobufs (needed for powermon goo)
* PowerStress WIP
* for #4154 and #4136 add concept of dependent gpios...
Which is currently only tested with the LED but eventually
will be used for shared GPIO/screen power rail enable
and LED forcing (which is a sanity check in the power stress
testing)
* fix linter warning
* Transformer is a better name for the LED input > operation > output classes
* PMW led changes to work on esp32-s3
* power stress improvements
* allow ble logrecords to be fetched either by NOTIFY or INDICATE ble types
This allows 'lossless' log reading. If client has requested INDICATE
(rather than NOTIFY) each log record emitted via log() will have to fetched
by the client device before the meshtastic node can continue.
* Fix serious problem with nrf52 BLE logging.
When doing notifies of LogRecords it is important to use the
binary write routines - writing using the 'string' write won't work.
Because protobufs can contain \0 nuls inside of them which if being
parsed as a string will cause only a portion of the protobuf to be sent.
I noticed this because some log messages were not getting through.
* fix gpio transformer stuff to work correctly with LED_INVERTED
Thanks @todd-herbert for noticing this and the great stack trace.
The root cause was that I had accidentially shadowed outPin in a subclass
with an unneeded override. It would break on any board that had inverted
LED power.
fixes
https://github.com/meshtastic/firmware/pull/4230#pullrequestreview-2217389099
* Support driving multiple output gpios from one input.
While investigating https://github.com/meshtastic/firmware/pull/4230#pullrequestreview-2217389099
I noticed in variant.h that there are now apparently newer TBEAMs than mine
that have _both_ a GPIO based power LED and the PMU based LED. Add a splitter
so that we can drive two output GPIOs from one logical signal.
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Fix wio-tracker-1110 lora radio reset GPIO assignment
This fixes flaky lora radio init on this board.
* No need to keep lr11x0 radio config during sleep anymore, also stop TCXO
I think the problem (at least on the board I'm using for power testing
a wio tracker 1110) was that actually the RESET GPIO was not correct for
the radio. This led to the radio not being properly reinited after exiting
sleep mode.
Now that the GPIO is fixed I can enter deep sleep (fully shutting down
radio) and then later when the CPU resets, it can successfully init the
radio and send packets.
After this seeming success, I also turned off the TCXO during sleep and that
worked as well.
* Fix I2C pindefs
* Initial driver testing for HT-VME290
* E-Ink full refresh after canned message pop up
* Tidy variant folders
* Clean ESP32 cpuDeepSleep method
Merge sections, and remove the random assortment of gpio holds left behind.
* Enable 32kHz in variant.h
* Orient E290 with LoRa antenna facing up
* Revert "Clean ESP32 cpuDeepSleep method"
This reverts commit cb8ee508ec2d6bc27a8e228021fd1efbd034c4a0.
* Reduce deep-sleep current for VME213 (non-intrusive)
Originally I made an attempt at tidying up the cpuDeepSleep method, but have reverted that. New commit makes only the changes needed to support VME213. Don't really want the headache of breaking sleep for other variants, especially when this PR is just about implementing new boards.
* Update lib_deps; remove board_level extra
* Make SPI frequency configurable on Native
* Make the tophone queue size configurable for Portduino
* The modified SPISettings must be configured in setup(), after config.yaml is processed
* make MeshService a pointer, so we can configure MAX_RX_TOPHONE at run time
* Got a little over excited with refactoring
* Silence a warning
* More compatible
Changed a RADIOMASTER_900_BANDIT_NANO to DISPLAY_FLIP_SCREEN that is responsible for flipping the OLED screen for better compatible with other devices.
* Update variant.h Radiomaster
Remove a un-used SCREEN_ROTATE and added DISPLAY_FLIP_SCREEN
* Cleanup - remove unused defines.
There were a number of defined variables that were carried over
from old code. - Removed.
Also a typo. - Fixed fix.
Also duplicate definitions of the number of seconds in a day.
-deduplicated.
* Cleanup - remove unused defines.
There were a number of defined variables that were carried over
from old code. - Removed.
Also a typo. - Fixed fix.
Also duplicate definitions of the number of seconds in a day.
-deduplicated.
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Event mode: Enforce reliable hop limit
* Event mode: Short circuit wantsLink on MQTT for default broker address
* Just enforce at channels level since everything uses this
* For events never forward packets with excessive hop_limit
* In EVENT_MODE, don't respond with hop_limit set more then the configured max.
* Correct hop_start when correcting hop_limit in event mode.
* Make EVENT_MODE work from userPrefs.h
* Event mode: Disallow Router or Repeater roles
---------
Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz>
* Macro to trace log all MeshPackets as JSON
* Comment
* Add trace logging to file for native target
* bytes to hex
* Add time_ms
---------
Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz>
* add a userPrefs.h file, default blank, which can be used to easily set defaults on custom builds.
* Add Splash Screen to userPrefs
* Add channel 0 defaults to userPrefs.h
* CONFIG_LORA_IGNORE_MQTT_DEFAULT
* Unify naming for USERPREFS defines
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Make STM compile again and update toolchain. The binary is too big for the flash. WIP
* Making progress with OSFS, still WIP
* more progress, still too big. Adding RAK3172 to the equasion
* Make STM compile again and update toolchain. The binary is too big for the flash. WIP
* Making progress with OSFS, still WIP
* more progress, still too big. Adding RAK3172 to the equasion
* still too big
* minimize build
* trunk fmt
* fix a couple of symbol clashes
* trunk fmt
* down to 101% with a release vs. debug build and omitting the flash strings
* fix compilation
* fix compilation once more
* update protobufs linkage
* - Toolchain updated
- Fixed macro error
* silence compiler warning
note: do something about this assert...
* new toolkit and fix Power.cpp
* STM32WL make it fit (#4330)
* Add option to exclude I2C parts
The I2C hals and related code uses a significant amount of flash space and aren't required for a basic node.
* Add option to disable Admin and NodeInfo modules
Disabled by default in minimal build. This saves a significant amount of flash
* Disable unused hals
These use up significant flash
* Add float support for printf for debugging
Makes serial look nice for debugging
* This breaks my build for some reason
* These build flags can save a bit of flash
* Don't disable NodeInfo and Admin modules in minimal build
They fit in flash
* Don't include printf float support by default
Only useful for debugging
---------
Co-authored-by: Adam Lawson <dev@goshawk22.uk>
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Adam Lawson <dev@goshawk22.uk>
* feature-T1000-E: add Added the board definition for T1000-E
- integrate a script for rapid dependency download that is compatible with both Linux and Windows platforms.
- add the pin definitions for UART, SPI, GPIO, and other peripherals have been ensured to be correct.
- add the env configuration for PlatformIO.
* refact-T1000-E: redefine T1000-E board
* feature-T1000-E: add basic sensors
* feature-T1000-E: add button init
* feat: add DRADIOLIB_GODMODE defination for use function setDioAsRfSwitch to DIO LORA RF
* feat : add gps(GNSS_Airoha) sleep mode
* feat: add behavier when rec or send message
* chore: hang IIC bus usage to avoid sensor address conflict
* feat: add sensor data acquisition
* feat : support Airoha GPS
- add disable it in FSM
- update lookForTime and lookForLocation function
* fix: fix a bug
* version: change version to 0.9.0
* Update tracker-t1000-e.json
Remove a space
* Delete variants/tracker-t1000-e/run_once.sh
Delete not need as we will change platformio.ini
* Update platformio.ini
Update SoftDevice 7.3.0 usage in line with other lr1110 targets
Do we need to keep GODMODE ?
* fix: Button behavier incorrect bug
* fix:remove some invaild code of TextMessageModule
* fix: remove invaild comment
* version: change version to 0.9.1
- update mark's patch
- remove some invaild code and comments
- fix button behavier
* trunk format
* fix: HELTEC_CAPSULE_SENSOR_V3 block got accidentally deleted
* fix: EnvironmentTelemetry upstream merge went awry.
* fix: Added macro definitions to ensure correct operation of LORA section
* fix :GNSS_AIROHA macro defination in line with others
* fix: upstream backmerge accidentally.
* fix: wrap macro PIN_3V3_EN BUZZER_EN_PIN GNSS_AIROHA in the TRACKER_T1000_E macro guard
---------
Co-authored-by: Mark Trevor Birss <markbirss@gmail.com>
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
* Make sure to call randomSeed() on esp32
* Randomize the top 22 bits of the Message ID
* Make it clear that we are not calling randomSeed() on purpose
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Fix LED pinout for T-Echo board marked v1.0, date 2021-6-28
* Merge PR #420
* Fixed double and missing Default class.
* Use correct format specifier and fixed typo.
* Removed duplicate code.
* Fix error: #if with no expression
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Upgrade module config state version but don't blow everything away
* ModuleConfig version intervals roll forward
* Be specific about version migration criteria
* initModuleConfigIntervals fix
* Don't forget power!
* Send StoreForward history of the server to a connected client
To extend the ToPhoneQueue
* Add delay after sending history info
* Don't allow history request over LoRa on default channel
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Add congestion scaling coefficient
* Added active mesh sized based interval scaling
* Moved back to bottom
* Format
* Add observers and use correct number of online nodes
* Updated setFrames in Screen.cpp
Added code to attempt to revert back to the same frame that user was on prior to setFrame reload.
* Space added Screen.cpp
* Update Screen.cpp
Make screen to revert to Frame 0 if the originally displayed frame is no longer there.
* Update Screen.cpp
Inserted boolean holdPosition into setFrames to indicate the requirement to stay on the same frame ( if =true) or else it will switch to new frame .
Only Screen::handleStatusUpdate calls with setFrame(true). ( For Node Updates)
All other types of updates call as before setFrame(), so it will change focus as needed.
* Hold position, even if number of frames increases
* Hold position, if handling an outgoing text message
* Update Screen.cpp
* Reverted chnages related to devicestate.has_rx_text_message
* Reset to master
* CannedMessages only handles routing packets when waiting for ACK
Previously, this was calling Screen::setFrames at unexpected times
* Gather position info about screen frames while regenerating
* Make admin module observable
Notify only when relevant. Currently: only to handle remove_nodenum.
* Optionally specify which frame to focus when setFrames runs
* UIFrameEvent uses enum instead of multiple booleans
* Allow modules to request their own frame to be focussed
This is done internally by calling MeshModule::requestFocus()
Easier this way, insteady of passing the info in the UIFrameEvent:
* Modules don't always know whether they should be focussed until after the UIFrameEvent has been raised, in dramFrame
* Don't have to pass reference to module instance as parameter though several methods
* E-Ink screensaver uses FOCUS_PRESERVE
Previously, it had its own basic implementation of this.
* Spelling: regional variant
* trunk
* Fix HAS_SCREEN guarding
* More HAS_SCREEN guarding
---------
Co-authored-by: BIST <77391720+slash-bit@users.noreply.github.com>
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: slash-bit <v-b2@live.com>