2023-07-26 16:48:04 -07:00
|
|
|
|
/**
|
|
|
|
|
|
* @file Power.cpp
|
2023-07-26 16:58:14 -07:00
|
|
|
|
* @brief This file contains the implementation of the Power class, which is responsible for managing power-related functionality
|
|
|
|
|
|
* of the device. It includes battery level sensing, power management unit (PMU) control, and power state machine management. The
|
|
|
|
|
|
* Power class is used by the main device class to manage power-related functionality.
|
|
|
|
|
|
*
|
|
|
|
|
|
* The file also includes implementations of various battery level sensors, such as the AnalogBatteryLevel class, which assumes
|
|
|
|
|
|
* the battery voltage is attached via a voltage-divider to an analog input.
|
|
|
|
|
|
*
|
2023-07-26 16:48:04 -07:00
|
|
|
|
* This file is part of the Meshtastic project.
|
|
|
|
|
|
* For more information, see: https://meshtastic.org/
|
|
|
|
|
|
*/
|
2020-06-28 19:03:39 -07:00
|
|
|
|
#include "power.h"
|
2021-01-16 23:10:08 -08:00
|
|
|
|
#include "NodeDB.h"
|
2020-06-27 21:19:49 -07:00
|
|
|
|
#include "PowerFSM.h"
|
2024-09-23 08:58:14 -05:00
|
|
|
|
#include "Throttle.h"
|
2023-01-21 14:34:29 +01:00
|
|
|
|
#include "buzz/buzz.h"
|
2022-05-07 20:31:21 +10:00
|
|
|
|
#include "configuration.h"
|
2020-06-27 21:19:49 -07:00
|
|
|
|
#include "main.h"
|
2023-08-17 20:22:34 -05:00
|
|
|
|
#include "meshUtils.h"
|
2020-06-27 21:19:49 -07:00
|
|
|
|
#include "sleep.h"
|
|
|
|
|
|
|
2023-11-22 09:30:55 -07:00
|
|
|
|
// Working USB detection for powered/charging states on the RAK platform
|
|
|
|
|
|
#ifdef NRF_APM
|
|
|
|
|
|
#include "nrfx_power.h"
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2024-03-25 05:33:57 -06:00
|
|
|
|
#if defined(DEBUG_HEAP_MQTT) && !MESHTASTIC_EXCLUDE_MQTT
|
2023-02-04 14:56:04 +01:00
|
|
|
|
#include "mqtt/MQTT.h"
|
|
|
|
|
|
#include "target_specific.h"
|
2024-07-03 15:39:09 -07:00
|
|
|
|
#if HAS_WIFI
|
2023-02-04 14:56:04 +01:00
|
|
|
|
#include <WiFi.h>
|
|
|
|
|
|
#endif
|
2024-09-23 08:58:14 -05:00
|
|
|
|
|
2025-03-15 14:15:35 +01:00
|
|
|
|
#if HAS_ETHERNET && defined(USE_WS5500)
|
|
|
|
|
|
#include <ETHClass2.h>
|
|
|
|
|
|
#define ETH ETH2
|
|
|
|
|
|
#endif // HAS_ETHERNET
|
|
|
|
|
|
|
2024-03-25 05:33:57 -06:00
|
|
|
|
#endif
|
2023-02-04 14:56:04 +01:00
|
|
|
|
|
2023-03-11 22:40:33 +01:00
|
|
|
|
#ifndef DELAY_FOREVER
|
2023-03-11 22:48:08 +01:00
|
|
|
|
#define DELAY_FOREVER portMAX_DELAY
|
2023-03-11 22:40:33 +01:00
|
|
|
|
#endif
|
|
|
|
|
|
|
2023-05-16 01:40:42 -04:00
|
|
|
|
#if defined(BATTERY_PIN) && defined(ARCH_ESP32)
|
2023-05-13 20:38:37 -04:00
|
|
|
|
|
2023-05-14 19:49:08 -04:00
|
|
|
|
#ifndef BAT_MEASURE_ADC_UNIT // ADC1 is default
|
2023-05-13 20:38:37 -04:00
|
|
|
|
static const adc1_channel_t adc_channel = ADC_CHANNEL;
|
2023-05-14 19:49:08 -04:00
|
|
|
|
static const adc_unit_t unit = ADC_UNIT_1;
|
|
|
|
|
|
#else // ADC2
|
2023-05-13 20:38:37 -04:00
|
|
|
|
static const adc2_channel_t adc_channel = ADC_CHANNEL;
|
2023-05-14 19:49:08 -04:00
|
|
|
|
static const adc_unit_t unit = ADC_UNIT_2;
|
2023-05-13 20:38:37 -04:00
|
|
|
|
RTC_NOINIT_ATTR uint64_t RTC_reg_b;
|
2023-05-14 19:49:08 -04:00
|
|
|
|
|
2023-05-16 01:40:42 -04:00
|
|
|
|
#endif // BAT_MEASURE_ADC_UNIT
|
2023-05-13 20:38:37 -04:00
|
|
|
|
|
|
|
|
|
|
esp_adc_cal_characteristics_t *adc_characs = (esp_adc_cal_characteristics_t *)calloc(1, sizeof(esp_adc_cal_characteristics_t));
|
2023-05-26 11:16:40 +00:00
|
|
|
|
#ifndef ADC_ATTENUATION
|
2024-05-22 05:02:09 +03:00
|
|
|
|
static const adc_atten_t atten = ADC_ATTEN_DB_12;
|
2023-05-26 11:16:40 +00:00
|
|
|
|
#else
|
|
|
|
|
|
static const adc_atten_t atten = ADC_ATTENUATION;
|
|
|
|
|
|
#endif
|
2023-05-16 01:40:42 -04:00
|
|
|
|
#endif // BATTERY_PIN && ARCH_ESP32
|
2023-05-13 20:38:37 -04:00
|
|
|
|
|
2024-03-12 17:55:31 +01:00
|
|
|
|
#ifdef EXT_CHRG_DETECT
|
|
|
|
|
|
#ifndef EXT_CHRG_DETECT_MODE
|
|
|
|
|
|
static const uint8_t ext_chrg_detect_mode = INPUT;
|
|
|
|
|
|
#else
|
|
|
|
|
|
static const uint8_t ext_chrg_detect_mode = EXT_CHRG_DETECT_MODE;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
#ifndef EXT_CHRG_DETECT_VALUE
|
|
|
|
|
|
static const uint8_t ext_chrg_detect_value = HIGH;
|
|
|
|
|
|
#else
|
|
|
|
|
|
static const uint8_t ext_chrg_detect_value = EXT_CHRG_DETECT_VALUE;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2025-04-28 18:35:13 -05:00
|
|
|
|
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
|
|
|
|
|
#if __has_include(<Adafruit_INA219.h>)
|
2023-06-02 06:32:34 -05:00
|
|
|
|
INA219Sensor ina219Sensor;
|
2025-04-28 18:35:13 -05:00
|
|
|
|
#else
|
|
|
|
|
|
NullSensor ina219Sensor;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if __has_include(<INA226.h>)
|
Detect charging status by measuring current flow with configured INA battery sensor (#5271)
* INA219 charging detection
minimal implementation: if there is a configured INA219 sensor for battery monitoring we can take the current flow across the shunt resistor to know if we are charging the battery - negative milliamps indicate charging
* Update Power.cpp
added comments and 2 extra defines to disable and swap detection direction
* Update Power.cpp
fix disabled case
* move getCurrentMa() to new CurrentSensor class
* INA219 charging detection
minimal implementation: if there is a configured INA219 sensor for battery monitoring we can take the current flow across the shunt resistor to know if we are charging the battery - negative milliamps indicate charging
* Update Power.cpp
added comments and 2 extra defines to disable and swap detection direction
* Update Power.cpp
fix disabled case
* move getCurrentMa() to new CurrentSensor class
* add INA3221 charging detection
* RP2040: Update core; add mDNS support (#5355)
* Update arduino-pico core
* RP2040: Add mDNS support
* SimpleMDNS `begin` now returns a bool
* Add `-g` option to `debug_build_flags` to link files for gdb
* RAK11310 needs old platform as well
* Change defines to specific architecture
* Core version 4.2.1 is out
* Add sudo to apt-get commands for Raspbian Build (#5364)
Without sudo, inadequate permissions to runs the commands meant
the build was failing.
* Typo fix in build_raspbian.yml (#5365)
s/sudp/sudo :(:(:(
* Rework some things
* Trunk
* Separate littlefs bundle
* version tags
* Diag
* Add littlefswebui
* Bug fixed in ExternalNotificationModule (#5375)
While `nagging` setExternalState wasn't written to Buzzer & Vibra so output was never toggled.
Possible fix for #5348
* Cleanup static files from bad Web UI bundle on 2.5.13 release (#5376)
* Cleanup static files from bad Web UI bundle on 2.5.13 release
* Check existence first
* Esp32 is the only one we care about
* Move some actions to after `startTransmit()` (#5383)
To minimize the time between channel scan and actual transmit
* [create-pull-request] automated change (#5380)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Allows all 3 PKI keys to be added to userPrefs.h (#4969) and a tool. (#5368)
* more userPrefs.h
Added PKI Admin keys to userPrefs.h
* Update userPrefs.h
Allows all 3 PKI keys to be added to userPrefs.h (#4969)
* Update NodeDB.cpp
Trunk
* Update userPrefs.h
Changed wording
* Create base64_to_hex.py
A little tool for converting base64 PKI Keys to decoded byte that userPrefs.h can understand.
* more userPrefs.h
Added PKI Admin keys to userPrefs.h
* Update userPrefs.h
Allows all 3 PKI keys to be added to userPrefs.h (#4969)
* Update NodeDB.cpp
Trunk
* Update userPrefs.h
Changed wording
* Create base64_to_hex.py
A little tool for converting base64 PKI Keys to decoded byte that userPrefs.h can understand.
* [create-pull-request] automated change (#5388)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* add smiley emoji (#5391)
* add smiley emoji
* clang-formatted
* Anable trace route function on wismeshtap platform (#5389)
* fix 'symbal' typo (#5395)
* [create-pull-request] automated change (#5399)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* /api/v1/fromradio: add OPTIONS handler for CORS. (#5386)
This avoids hitting the 404 Not Found handler, which breaks connection
keep-alive, so this change fixes a big performance regression for Web Client in
Chrome: https://github.com/meshtastic/firmware/issues/5385
Tested on Heltec V3.
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Make heart emoji usable (#5403)
* Create a specific hw_model for WisMesh Tap (#5400)
* Create a specific hw_model for WisMesh Tap
* Trunk
* HAS_ETHERNET
* Remove it altogether
* Don't need these either
* Fix RTC time injection and consolidate position logic (#5396)
* Fix RTC time injection and consolidate position logic
* Comment out unused var warning
* Backerds
* Update arduino-pico core to fix sporadic hangs (#5406)
* Update platform-raspberrypi also (#5407)
* Update arduino-pico core to fix sporadic hangs
* Update platform-raspberrypi also
* --web added to device-install(.sh/.bat) (#5405)
* Add --web
* Update device-install.bat
Forgot a "-" a few places.
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* add GPS in indicator board (#5411)
* Fixed NMEA sentence issue in CalTopo as well as bug with no printing all of the nodes (#5412)
* --web littlefswebui-* typo fix (#5416)
* Add --web
* Update device-install.bat
Forgot a "-" a few places.
* Typo fix.
* Typo fix
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: GUVWAF <78759985+GUVWAF@users.noreply.github.com>
* Temporarily disable MDNS when MQTT is enabled (#5418)
Leads to a panic
* Check for OkToMqtt flag presence before uplinking to MQTT (#5413)
* Check for oktomqtt flag presence before uplinking to MQTT
* Move to mqtt->onSend
* Temetry can respond to want-response for LocalStats variant (#5414)
* Seems like the last DIY board that's not "extra" (#5420)
* Cherry pick tdeck fixes (#5422)
* Try-fix (workaround) T-Deck audio crash
* set T-Deck audio to unused 48 (mem mclk)
* swap mclk to gpio 21
* dreamcatcher: assign GPIO44 to audio mclk
---------
Co-authored-by: mverch67 <manuel.verch@gmx.de>
* add canned message and keyboard in indicator board (#5410)
* add canned message and keyboard in indicator board
* Added virtual keyboard macro and enabled for Indicator
* Cleanup macros by applying USE_VIRTUAL_KEYBOARD and DISPLAY_CLOCK_FRAME
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Update build-native.sh (#5415)
* Update build-native.sh
Device-install.sh and device-update.sh are not used on native platform, skip copying to release directory after build and copy native-install.sh and native-run.sh instead.
* Update build-native.sh
Skip native-run.sh copy
* Cleans up visibility in GPS.h (#5426)
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
* Fix admin key loading from userPrefs.h (#5417)
* 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
* Fix warning: extra tokens at end of #endif directive.
* Fix antenna switching logic. Complementary-pin control logic is required on the rp2040-lora board.
* Fix deprecated macros.
* Set RP2040 in dormant mode when deep sleep is triggered.
* Fix array out of bounds read.
* Admin key count needs to be set otherwise the key will be zero loaded after reset.
* Don't reset the admin key size when loading defaults. Preserve an existing key in config if possible.
* Remove log spam when reading INA voltage sensor.
* Remove static declaration for admin keys from userPrefs.h. Load hard coded admin keys in case config file has empty slots.
* Removed newlines from log.
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
* try to detect dfrobot station to tell it apart from an ublox gps. (#5393)
* Remove BMA-423 and STK8X by default (#5429)
* Remove BMA-423 by default
* STK
* Wrong macro
* Helps if you include the file
* [create-pull-request] automated change (#5431)
Co-authored-by: caveman99 <25002+caveman99@users.noreply.github.com>
* Support for the ClimateGuard RadSens Geiger-Muller tube (#5425)
* fixes https://github.com/meshtastic/firmware/issues/5434 (#5435)
* update libpax
* fix interval init
* Fix memory leaks by adding missing `free()` calls before early returns in `MQTT::onReceive` (#5439)
This fix addresses memory leaks in the `MQTT::onReceive` function by ensuring that dynamically allocated resources (`e.channel_id`, `e.gateway_id` and `e.packet`) are properly freed before each early return. Previously, these resources were only freed at the end of the function, leaving them unhandled in certain exit paths. Adding the missing `free()` calls prevents memory leaks and ensures proper resource cleanup in all scenarios.
* Removing 1.0 legacy boards from releases and completely removing Heltec wireless capsule from support (#5436)
Co-authored-by: Tom Fifield <tom@tomfifield.net>
* A second round of cleanup on GPS.h. (#5433)
* Move yet more stuff out of GPS.h and into file scope.
* Protect code macros from eating semicolons.
* Remove unused (and unimplemented) getDOPString.
* clang-format with project style file on affected files.
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
* enable MQTT with TLS on RPi picow (#5442)
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Don't powersave on Wifi (#5443)
* Don't go into light sleep with wifi enabled
* Move
* Trunk
* Revert "Seems like the last DIY board that's not "extra" (#5420)" (#5446)
This reverts commit e6fb6b115aebb12b31fb93ed9d1508a6109b2f03.
* Actually gunzip all the files when building a .deb (#5449)
* [create-pull-request] automated change (#5457)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Cleanup i2c scan logs and macro to save some bytes and remain consistent (#5455)
* Cleanup i2c scan logs and macro to save some bytes and remain consistent
* Functions are better than macros
* Exclude i2c scan for STM32
* Useless log
* Clean up some inline functions (#5454)
* Use isWithinTimespanMs to avoid refererence to NodeDb instance inside of NodeDb (#5453)
* fix cors for meshtasticd to allow use of cross origin clients (#5463)
* Remove ATECC crypto chip placeholder code (#5461)
* GPS.h cleanups round 3. (#5447)
* GPS.h cleanups round 3.
No effective behavior change.
Protected members can be private so make it so. (Supporting
subclasses needs a lot more work.)
Moves uBloxGnssModelInfo into file scope.
Moves uBloxProtocolVersion into uBloxGnssModelInfo.
Moves baud rate arrays into file scope.
Removes unused/ unimplemented powerStateToString.
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
* Trunk Format.
---------
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
Co-authored-by: Tom Fifield <tom@tomfifield.net>
* Fix ukrainian fonts (#5468)
* FIX: rollback to !4624
* UPDATE: new 16 and 24 UA Fonts and fixes
* fix: Solve the lightsleep crash problem via disable lightsleep for indicator. (#5470)
* Trunk
* Warnings and log cleanup (#5472)
* Don't log if keyboard not found
* Signed comparison issue
* [create-pull-request] automated change (#5475)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Adds libusb dev package to Raspbian build steps (#5480)
* [create-pull-request] automated change (#5478)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Portduino fixes (#5479)
* Set config.yaml defaults even if General is missing
* Unsigned values should get %u in logging
* Update arduino-pico core and remove MDNS restriction (#5483)
* Update xiao_esp32 fully support L67K (#5488)
L67K module hardware changed
* Convert userprefs to a json file instead of header file which has to be included everywhere (#5471)
* WIP
* Got string quoting and macro expansion working
* Need the placeholder
* Cleanup
* Missed a user prefs reference
* Update jsonc
* SimRadio: clean-up and emulate collisions (#5487)
* Clean up SimRadio and don't let it use PKC
* Add collision emulation for SimRadio
* Add stats from SimRadio to LocalStats
* Make emulating collisions optional
* add nodeId to nodeinfo update log lines and removed redundant nodeinfo update log line (#5493)
* Refact the macro definition of GPS initialization of GPSDEFAULTD_NOT_PRESENT and added seeeed Indicator to this sequence (#5494)
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Extend Length of Source and Destination Node IDs Logged (#5492)
* show 8 chars for logging source and destination ids
* extend legnth of source and destination nodes in log
* Added femtofox configs (#5477)
* added femtofox configs
* Rename bin/config.d/femtofox_Waveshare-SX126X-XXXM_AI-Thinker-RA-01SH.yaml to bin/config.d/femtofox/femtofox_Waveshare-SX126X-XXXM_AI-Thinker-RA-01SH.yaml
* moved femtofox configs to subdir
* [Add] LR1110, LR1120 and LR1121 to linux native Portduino (#5496)
* Update main.cpp
* Update PortduinoGlue.h
* Update PortduinoGlue.cpp
* Update PortduinoGlue.cpp
* Update PortduinoGlue.cpp
* Update main.cpp
* [create-pull-request] automated change (#5500)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Fix minor typos in package workflows (#5505)
* Don't use channel index for encrypted packet (#5509)
* Don't use channel index for encrypted packet
* Remove assert in `getKey`, set invalid key length
So encrypting will fail without reboot
* Reset channel to 0 when unable to encrypt
Such that the NAK doesn't use the failing channel hash
* Always Announce MDNS meshtastic service (#5503)
* refactor server api port into define
* always announce MDNS meshtastic service
* fix nodeDB erase loop when free mem returns invalid value (0, -1). (#5519)
Co-authored-by: mverch67 <manuel.verch@gmx.de>
* Add heltec capsule back
* Revert "Add heltec capsule back"
This reverts commit fc16d9342116235fa86cf6ac163b17125bb4b50e.
* Lets try this again minus device ui
* Add popular nrf52 pro micro to the builds (#5523)
* Add MACAddress to config.yaml (#5506)
* Add MACAddress to config.yaml
* Better error handling on native, including failing to launch with blank MAC Address and real hardware.
* Re-arrange Mac Address handling and add MACAddressSource
* Bump portduino to remove macaddr function there
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Configure Seeed Xiao S3 RX enable pin (#5517)
* Create OpenWRT_One_mikroBUS_sx1262.yaml (#5529)
* tlora_v2_1_16: Unset BUTTON_PIN and BUTTON_NEED_PULLUP (#5535)
Unset BUTTON_PIN and BUTTON_NEED_PULLUP as the board ships without a user button.
Devices and users expecting a button on GPIO12 have to set [GPIO for user button](https://meshtastic.org/docs/configuration/radio/device/#gpio-for-user-button) to 12 (or any GPIO pin the momentary switch was connected to) to restore functionality.
Signed-off-by: Andrew Yong <me@ndoo.sg>
* [create-pull-request] automated change (#5530)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Fix detection for some RadSens hardware versions (#5542)
Co-authored-by: Jake-B <jake-b@users.noreply.github.com>
* Initialize dmac array to nulls (#5538)
* Initialize dmac array to nulls
* Use std::cout for print before console is init.
* Update OpenWRT_One_mikroBUS_sx1262.yaml (#5544)
* Add portduino-buildroot variant (#5540)
* Add portduino-buildroot variant
* Update platform-native for platform-buildroot
* portduino-buildroot: Define c standard (#5547)
* Portduino: Move meshtasticd/web out of /usr/share/doc/ (#5548)
* Portduino: fix transitional symlinks (#5550)
* Windows Support - Trunk and Platformio (#5397) (#5518)
* Add support for GPG
* Add usb device support
* Add trunk.io to devcontainer
* Trunk things
* trunk fmt
* formatting
* fix trivy/DS002, checkov/CKV_DOCKER_3
* hide docker extension popup
* fix trivy/DS026, checkov/CKV_DOCKER_2
Co-authored-by: Kalle Lilja <15094562+ThatKalle@users.noreply.github.com>
* Synch minor changes from TFT branch (#5520)
* Synch minor changes from TFT branch
Includes:
* New nordicnrf52 minor version (10.5.0 --> 10.6.0)
* Optimisations for T_DECK
* preparation for MESH_TAB
* add ext notification module to portduino
---------
Co-authored-by: mverch67 <manuel.verch@gmx.de>
* DIO3_TCXO_VOLTAGE in config.yaml can now take an exact voltage (#5558)
* Support TLORA_V3.0 (#5563)
- Support TLORA_V3.0. Update of the legendary 2.1_1.6.1 with solar charger, TCXO and IPEX connector.
- 'extra' some short-lived EOL intermediate boards in that range. If possible use T3S3 instead of all of these!
- update trunk to latest version
* Create OpenWRT-One-mikroBUS-LR-IOT-CLICK.yaml (#5564)
* Portduino: fix setting hwId via argument (#5565)
* INA219 charging detection
minimal implementation: if there is a configured INA219 sensor for battery monitoring we can take the current flow across the shunt resistor to know if we are charging the battery - negative milliamps indicate charging
* Update Power.cpp
added comments and 2 extra defines to disable and swap detection direction
* Trunk Fixes
* Add INA226 support
---------
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
Signed-off-by: Andrew Yong <me@ndoo.sg>
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz>
Co-authored-by: GUVWAF <78759985+GUVWAF@users.noreply.github.com>
Co-authored-by: Tom Fifield <tom@tomfifield.net>
Co-authored-by: Michael Gjelsø <36234524+gjelsoe@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
Co-authored-by: jcyrio <50239349+jcyrio@users.noreply.github.com>
Co-authored-by: Daniel.Cao <144674500+DanielCao0@users.noreply.github.com>
Co-authored-by: Catalin Patulea <cronos586@gmail.com>
Co-authored-by: dylanli <dylan3000dylan@gmail.com>
Co-authored-by: mverch67 <manuel.verch@gmx.de>
Co-authored-by: madeofstown <33820964+madeofstown@users.noreply.github.com>
Co-authored-by: Christopher Hoover <ch@murgatroid.com>
Co-authored-by: Mictronics <github@mictronics.de>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
Co-authored-by: caveman99 <25002+caveman99@users.noreply.github.com>
Co-authored-by: jake-b <1012393+jake-b@users.noreply.github.com>
Co-authored-by: César de Tassis Filho <CTassisF@users.noreply.github.com>
Co-authored-by: Tomas Dubec <tomas.dubec@gmail.com>
Co-authored-by: Liam Cottle <liam@liamcottle.com>
Co-authored-by: panaceya <panaceya@users.noreply.github.com>
Co-authored-by: virgil <virgil.wang.cj@gmail.com>
Co-authored-by: Robert <r@rbrt.io>
Co-authored-by: noon92 <40807970+noon92@users.noreply.github.com>
Co-authored-by: Mark Trevor Birss <markbirss@gmail.com>
Co-authored-by: broglep <20624281+broglep@users.noreply.github.com>
Co-authored-by: Matthias Granberry <matthias.granberry@gmail.com>
Co-authored-by: Andrew Yong <me@ndoo.sg>
Co-authored-by: Jake-B <jake-b@users.noreply.github.com>
Co-authored-by: Austin <vidplace7@gmail.com>
Co-authored-by: Kalle Lilja <15094562+ThatKalle@users.noreply.github.com>
2024-12-22 05:02:50 +01:00
|
|
|
|
INA226Sensor ina226Sensor;
|
2025-04-28 18:35:13 -05:00
|
|
|
|
#else
|
|
|
|
|
|
NullSensor ina226Sensor;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if __has_include(<Adafruit_INA260.h>)
|
Detect charging status by measuring current flow with configured INA battery sensor (#5271)
* INA219 charging detection
minimal implementation: if there is a configured INA219 sensor for battery monitoring we can take the current flow across the shunt resistor to know if we are charging the battery - negative milliamps indicate charging
* Update Power.cpp
added comments and 2 extra defines to disable and swap detection direction
* Update Power.cpp
fix disabled case
* move getCurrentMa() to new CurrentSensor class
* INA219 charging detection
minimal implementation: if there is a configured INA219 sensor for battery monitoring we can take the current flow across the shunt resistor to know if we are charging the battery - negative milliamps indicate charging
* Update Power.cpp
added comments and 2 extra defines to disable and swap detection direction
* Update Power.cpp
fix disabled case
* move getCurrentMa() to new CurrentSensor class
* add INA3221 charging detection
* RP2040: Update core; add mDNS support (#5355)
* Update arduino-pico core
* RP2040: Add mDNS support
* SimpleMDNS `begin` now returns a bool
* Add `-g` option to `debug_build_flags` to link files for gdb
* RAK11310 needs old platform as well
* Change defines to specific architecture
* Core version 4.2.1 is out
* Add sudo to apt-get commands for Raspbian Build (#5364)
Without sudo, inadequate permissions to runs the commands meant
the build was failing.
* Typo fix in build_raspbian.yml (#5365)
s/sudp/sudo :(:(:(
* Rework some things
* Trunk
* Separate littlefs bundle
* version tags
* Diag
* Add littlefswebui
* Bug fixed in ExternalNotificationModule (#5375)
While `nagging` setExternalState wasn't written to Buzzer & Vibra so output was never toggled.
Possible fix for #5348
* Cleanup static files from bad Web UI bundle on 2.5.13 release (#5376)
* Cleanup static files from bad Web UI bundle on 2.5.13 release
* Check existence first
* Esp32 is the only one we care about
* Move some actions to after `startTransmit()` (#5383)
To minimize the time between channel scan and actual transmit
* [create-pull-request] automated change (#5380)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Allows all 3 PKI keys to be added to userPrefs.h (#4969) and a tool. (#5368)
* more userPrefs.h
Added PKI Admin keys to userPrefs.h
* Update userPrefs.h
Allows all 3 PKI keys to be added to userPrefs.h (#4969)
* Update NodeDB.cpp
Trunk
* Update userPrefs.h
Changed wording
* Create base64_to_hex.py
A little tool for converting base64 PKI Keys to decoded byte that userPrefs.h can understand.
* more userPrefs.h
Added PKI Admin keys to userPrefs.h
* Update userPrefs.h
Allows all 3 PKI keys to be added to userPrefs.h (#4969)
* Update NodeDB.cpp
Trunk
* Update userPrefs.h
Changed wording
* Create base64_to_hex.py
A little tool for converting base64 PKI Keys to decoded byte that userPrefs.h can understand.
* [create-pull-request] automated change (#5388)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* add smiley emoji (#5391)
* add smiley emoji
* clang-formatted
* Anable trace route function on wismeshtap platform (#5389)
* fix 'symbal' typo (#5395)
* [create-pull-request] automated change (#5399)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* /api/v1/fromradio: add OPTIONS handler for CORS. (#5386)
This avoids hitting the 404 Not Found handler, which breaks connection
keep-alive, so this change fixes a big performance regression for Web Client in
Chrome: https://github.com/meshtastic/firmware/issues/5385
Tested on Heltec V3.
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Make heart emoji usable (#5403)
* Create a specific hw_model for WisMesh Tap (#5400)
* Create a specific hw_model for WisMesh Tap
* Trunk
* HAS_ETHERNET
* Remove it altogether
* Don't need these either
* Fix RTC time injection and consolidate position logic (#5396)
* Fix RTC time injection and consolidate position logic
* Comment out unused var warning
* Backerds
* Update arduino-pico core to fix sporadic hangs (#5406)
* Update platform-raspberrypi also (#5407)
* Update arduino-pico core to fix sporadic hangs
* Update platform-raspberrypi also
* --web added to device-install(.sh/.bat) (#5405)
* Add --web
* Update device-install.bat
Forgot a "-" a few places.
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* add GPS in indicator board (#5411)
* Fixed NMEA sentence issue in CalTopo as well as bug with no printing all of the nodes (#5412)
* --web littlefswebui-* typo fix (#5416)
* Add --web
* Update device-install.bat
Forgot a "-" a few places.
* Typo fix.
* Typo fix
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: GUVWAF <78759985+GUVWAF@users.noreply.github.com>
* Temporarily disable MDNS when MQTT is enabled (#5418)
Leads to a panic
* Check for OkToMqtt flag presence before uplinking to MQTT (#5413)
* Check for oktomqtt flag presence before uplinking to MQTT
* Move to mqtt->onSend
* Temetry can respond to want-response for LocalStats variant (#5414)
* Seems like the last DIY board that's not "extra" (#5420)
* Cherry pick tdeck fixes (#5422)
* Try-fix (workaround) T-Deck audio crash
* set T-Deck audio to unused 48 (mem mclk)
* swap mclk to gpio 21
* dreamcatcher: assign GPIO44 to audio mclk
---------
Co-authored-by: mverch67 <manuel.verch@gmx.de>
* add canned message and keyboard in indicator board (#5410)
* add canned message and keyboard in indicator board
* Added virtual keyboard macro and enabled for Indicator
* Cleanup macros by applying USE_VIRTUAL_KEYBOARD and DISPLAY_CLOCK_FRAME
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Update build-native.sh (#5415)
* Update build-native.sh
Device-install.sh and device-update.sh are not used on native platform, skip copying to release directory after build and copy native-install.sh and native-run.sh instead.
* Update build-native.sh
Skip native-run.sh copy
* Cleans up visibility in GPS.h (#5426)
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
* Fix admin key loading from userPrefs.h (#5417)
* 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
* Fix warning: extra tokens at end of #endif directive.
* Fix antenna switching logic. Complementary-pin control logic is required on the rp2040-lora board.
* Fix deprecated macros.
* Set RP2040 in dormant mode when deep sleep is triggered.
* Fix array out of bounds read.
* Admin key count needs to be set otherwise the key will be zero loaded after reset.
* Don't reset the admin key size when loading defaults. Preserve an existing key in config if possible.
* Remove log spam when reading INA voltage sensor.
* Remove static declaration for admin keys from userPrefs.h. Load hard coded admin keys in case config file has empty slots.
* Removed newlines from log.
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
* try to detect dfrobot station to tell it apart from an ublox gps. (#5393)
* Remove BMA-423 and STK8X by default (#5429)
* Remove BMA-423 by default
* STK
* Wrong macro
* Helps if you include the file
* [create-pull-request] automated change (#5431)
Co-authored-by: caveman99 <25002+caveman99@users.noreply.github.com>
* Support for the ClimateGuard RadSens Geiger-Muller tube (#5425)
* fixes https://github.com/meshtastic/firmware/issues/5434 (#5435)
* update libpax
* fix interval init
* Fix memory leaks by adding missing `free()` calls before early returns in `MQTT::onReceive` (#5439)
This fix addresses memory leaks in the `MQTT::onReceive` function by ensuring that dynamically allocated resources (`e.channel_id`, `e.gateway_id` and `e.packet`) are properly freed before each early return. Previously, these resources were only freed at the end of the function, leaving them unhandled in certain exit paths. Adding the missing `free()` calls prevents memory leaks and ensures proper resource cleanup in all scenarios.
* Removing 1.0 legacy boards from releases and completely removing Heltec wireless capsule from support (#5436)
Co-authored-by: Tom Fifield <tom@tomfifield.net>
* A second round of cleanup on GPS.h. (#5433)
* Move yet more stuff out of GPS.h and into file scope.
* Protect code macros from eating semicolons.
* Remove unused (and unimplemented) getDOPString.
* clang-format with project style file on affected files.
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
* enable MQTT with TLS on RPi picow (#5442)
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Don't powersave on Wifi (#5443)
* Don't go into light sleep with wifi enabled
* Move
* Trunk
* Revert "Seems like the last DIY board that's not "extra" (#5420)" (#5446)
This reverts commit e6fb6b115aebb12b31fb93ed9d1508a6109b2f03.
* Actually gunzip all the files when building a .deb (#5449)
* [create-pull-request] automated change (#5457)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Cleanup i2c scan logs and macro to save some bytes and remain consistent (#5455)
* Cleanup i2c scan logs and macro to save some bytes and remain consistent
* Functions are better than macros
* Exclude i2c scan for STM32
* Useless log
* Clean up some inline functions (#5454)
* Use isWithinTimespanMs to avoid refererence to NodeDb instance inside of NodeDb (#5453)
* fix cors for meshtasticd to allow use of cross origin clients (#5463)
* Remove ATECC crypto chip placeholder code (#5461)
* GPS.h cleanups round 3. (#5447)
* GPS.h cleanups round 3.
No effective behavior change.
Protected members can be private so make it so. (Supporting
subclasses needs a lot more work.)
Moves uBloxGnssModelInfo into file scope.
Moves uBloxProtocolVersion into uBloxGnssModelInfo.
Moves baud rate arrays into file scope.
Removes unused/ unimplemented powerStateToString.
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
* Trunk Format.
---------
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
Co-authored-by: Tom Fifield <tom@tomfifield.net>
* Fix ukrainian fonts (#5468)
* FIX: rollback to !4624
* UPDATE: new 16 and 24 UA Fonts and fixes
* fix: Solve the lightsleep crash problem via disable lightsleep for indicator. (#5470)
* Trunk
* Warnings and log cleanup (#5472)
* Don't log if keyboard not found
* Signed comparison issue
* [create-pull-request] automated change (#5475)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Adds libusb dev package to Raspbian build steps (#5480)
* [create-pull-request] automated change (#5478)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Portduino fixes (#5479)
* Set config.yaml defaults even if General is missing
* Unsigned values should get %u in logging
* Update arduino-pico core and remove MDNS restriction (#5483)
* Update xiao_esp32 fully support L67K (#5488)
L67K module hardware changed
* Convert userprefs to a json file instead of header file which has to be included everywhere (#5471)
* WIP
* Got string quoting and macro expansion working
* Need the placeholder
* Cleanup
* Missed a user prefs reference
* Update jsonc
* SimRadio: clean-up and emulate collisions (#5487)
* Clean up SimRadio and don't let it use PKC
* Add collision emulation for SimRadio
* Add stats from SimRadio to LocalStats
* Make emulating collisions optional
* add nodeId to nodeinfo update log lines and removed redundant nodeinfo update log line (#5493)
* Refact the macro definition of GPS initialization of GPSDEFAULTD_NOT_PRESENT and added seeeed Indicator to this sequence (#5494)
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Extend Length of Source and Destination Node IDs Logged (#5492)
* show 8 chars for logging source and destination ids
* extend legnth of source and destination nodes in log
* Added femtofox configs (#5477)
* added femtofox configs
* Rename bin/config.d/femtofox_Waveshare-SX126X-XXXM_AI-Thinker-RA-01SH.yaml to bin/config.d/femtofox/femtofox_Waveshare-SX126X-XXXM_AI-Thinker-RA-01SH.yaml
* moved femtofox configs to subdir
* [Add] LR1110, LR1120 and LR1121 to linux native Portduino (#5496)
* Update main.cpp
* Update PortduinoGlue.h
* Update PortduinoGlue.cpp
* Update PortduinoGlue.cpp
* Update PortduinoGlue.cpp
* Update main.cpp
* [create-pull-request] automated change (#5500)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Fix minor typos in package workflows (#5505)
* Don't use channel index for encrypted packet (#5509)
* Don't use channel index for encrypted packet
* Remove assert in `getKey`, set invalid key length
So encrypting will fail without reboot
* Reset channel to 0 when unable to encrypt
Such that the NAK doesn't use the failing channel hash
* Always Announce MDNS meshtastic service (#5503)
* refactor server api port into define
* always announce MDNS meshtastic service
* fix nodeDB erase loop when free mem returns invalid value (0, -1). (#5519)
Co-authored-by: mverch67 <manuel.verch@gmx.de>
* Add heltec capsule back
* Revert "Add heltec capsule back"
This reverts commit fc16d9342116235fa86cf6ac163b17125bb4b50e.
* Lets try this again minus device ui
* Add popular nrf52 pro micro to the builds (#5523)
* Add MACAddress to config.yaml (#5506)
* Add MACAddress to config.yaml
* Better error handling on native, including failing to launch with blank MAC Address and real hardware.
* Re-arrange Mac Address handling and add MACAddressSource
* Bump portduino to remove macaddr function there
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Configure Seeed Xiao S3 RX enable pin (#5517)
* Create OpenWRT_One_mikroBUS_sx1262.yaml (#5529)
* tlora_v2_1_16: Unset BUTTON_PIN and BUTTON_NEED_PULLUP (#5535)
Unset BUTTON_PIN and BUTTON_NEED_PULLUP as the board ships without a user button.
Devices and users expecting a button on GPIO12 have to set [GPIO for user button](https://meshtastic.org/docs/configuration/radio/device/#gpio-for-user-button) to 12 (or any GPIO pin the momentary switch was connected to) to restore functionality.
Signed-off-by: Andrew Yong <me@ndoo.sg>
* [create-pull-request] automated change (#5530)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Fix detection for some RadSens hardware versions (#5542)
Co-authored-by: Jake-B <jake-b@users.noreply.github.com>
* Initialize dmac array to nulls (#5538)
* Initialize dmac array to nulls
* Use std::cout for print before console is init.
* Update OpenWRT_One_mikroBUS_sx1262.yaml (#5544)
* Add portduino-buildroot variant (#5540)
* Add portduino-buildroot variant
* Update platform-native for platform-buildroot
* portduino-buildroot: Define c standard (#5547)
* Portduino: Move meshtasticd/web out of /usr/share/doc/ (#5548)
* Portduino: fix transitional symlinks (#5550)
* Windows Support - Trunk and Platformio (#5397) (#5518)
* Add support for GPG
* Add usb device support
* Add trunk.io to devcontainer
* Trunk things
* trunk fmt
* formatting
* fix trivy/DS002, checkov/CKV_DOCKER_3
* hide docker extension popup
* fix trivy/DS026, checkov/CKV_DOCKER_2
Co-authored-by: Kalle Lilja <15094562+ThatKalle@users.noreply.github.com>
* Synch minor changes from TFT branch (#5520)
* Synch minor changes from TFT branch
Includes:
* New nordicnrf52 minor version (10.5.0 --> 10.6.0)
* Optimisations for T_DECK
* preparation for MESH_TAB
* add ext notification module to portduino
---------
Co-authored-by: mverch67 <manuel.verch@gmx.de>
* DIO3_TCXO_VOLTAGE in config.yaml can now take an exact voltage (#5558)
* Support TLORA_V3.0 (#5563)
- Support TLORA_V3.0. Update of the legendary 2.1_1.6.1 with solar charger, TCXO and IPEX connector.
- 'extra' some short-lived EOL intermediate boards in that range. If possible use T3S3 instead of all of these!
- update trunk to latest version
* Create OpenWRT-One-mikroBUS-LR-IOT-CLICK.yaml (#5564)
* Portduino: fix setting hwId via argument (#5565)
* INA219 charging detection
minimal implementation: if there is a configured INA219 sensor for battery monitoring we can take the current flow across the shunt resistor to know if we are charging the battery - negative milliamps indicate charging
* Update Power.cpp
added comments and 2 extra defines to disable and swap detection direction
* Trunk Fixes
* Add INA226 support
---------
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
Signed-off-by: Andrew Yong <me@ndoo.sg>
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz>
Co-authored-by: GUVWAF <78759985+GUVWAF@users.noreply.github.com>
Co-authored-by: Tom Fifield <tom@tomfifield.net>
Co-authored-by: Michael Gjelsø <36234524+gjelsoe@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
Co-authored-by: jcyrio <50239349+jcyrio@users.noreply.github.com>
Co-authored-by: Daniel.Cao <144674500+DanielCao0@users.noreply.github.com>
Co-authored-by: Catalin Patulea <cronos586@gmail.com>
Co-authored-by: dylanli <dylan3000dylan@gmail.com>
Co-authored-by: mverch67 <manuel.verch@gmx.de>
Co-authored-by: madeofstown <33820964+madeofstown@users.noreply.github.com>
Co-authored-by: Christopher Hoover <ch@murgatroid.com>
Co-authored-by: Mictronics <github@mictronics.de>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
Co-authored-by: caveman99 <25002+caveman99@users.noreply.github.com>
Co-authored-by: jake-b <1012393+jake-b@users.noreply.github.com>
Co-authored-by: César de Tassis Filho <CTassisF@users.noreply.github.com>
Co-authored-by: Tomas Dubec <tomas.dubec@gmail.com>
Co-authored-by: Liam Cottle <liam@liamcottle.com>
Co-authored-by: panaceya <panaceya@users.noreply.github.com>
Co-authored-by: virgil <virgil.wang.cj@gmail.com>
Co-authored-by: Robert <r@rbrt.io>
Co-authored-by: noon92 <40807970+noon92@users.noreply.github.com>
Co-authored-by: Mark Trevor Birss <markbirss@gmail.com>
Co-authored-by: broglep <20624281+broglep@users.noreply.github.com>
Co-authored-by: Matthias Granberry <matthias.granberry@gmail.com>
Co-authored-by: Andrew Yong <me@ndoo.sg>
Co-authored-by: Jake-B <jake-b@users.noreply.github.com>
Co-authored-by: Austin <vidplace7@gmail.com>
Co-authored-by: Kalle Lilja <15094562+ThatKalle@users.noreply.github.com>
2024-12-22 05:02:50 +01:00
|
|
|
|
INA260Sensor ina260Sensor;
|
2025-04-28 18:35:13 -05:00
|
|
|
|
#else
|
|
|
|
|
|
NullSensor ina260Sensor;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if __has_include(<INA3221.h>)
|
2023-11-17 05:46:59 -07:00
|
|
|
|
INA3221Sensor ina3221Sensor;
|
2025-04-28 18:35:13 -05:00
|
|
|
|
#else
|
|
|
|
|
|
NullSensor ina3221Sensor;
|
2023-06-02 06:32:34 -05:00
|
|
|
|
#endif
|
|
|
|
|
|
|
2025-04-28 18:35:13 -05:00
|
|
|
|
#endif
|
|
|
|
|
|
|
2025-07-02 12:01:45 +01:00
|
|
|
|
#if !MESHTASTIC_EXCLUDE_I2C
|
2024-09-25 20:34:53 +10:00
|
|
|
|
#include "modules/Telemetry/Sensor/MAX17048Sensor.h"
|
|
|
|
|
|
#include <utility>
|
|
|
|
|
|
extern std::pair<uint8_t, TwoWire *> nodeTelemetrySensorsMap[_meshtastic_TelemetrySensorType_MAX + 1];
|
|
|
|
|
|
#if HAS_TELEMETRY && (!MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR || !MESHTASTIC_EXCLUDE_POWER_TELEMETRY)
|
2025-04-28 18:35:13 -05:00
|
|
|
|
#if __has_include(<Adafruit_MAX1704X.h>)
|
2024-09-25 20:34:53 +10:00
|
|
|
|
MAX17048Sensor max17048Sensor;
|
2025-04-28 18:35:13 -05:00
|
|
|
|
#else
|
|
|
|
|
|
NullSensor max17048Sensor;
|
|
|
|
|
|
#endif
|
2024-09-25 20:34:53 +10:00
|
|
|
|
#endif
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2025-04-28 18:35:13 -05:00
|
|
|
|
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && HAS_RAKPROT
|
2024-06-16 14:24:36 +08:00
|
|
|
|
RAK9154Sensor rak9154Sensor;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2022-09-08 10:36:53 +08:00
|
|
|
|
#ifdef HAS_PMU
|
2022-09-06 15:58:33 +08:00
|
|
|
|
XPowersLibInterface *PMU = NULL;
|
2021-03-14 19:00:20 -07:00
|
|
|
|
#else
|
2023-06-02 06:32:34 -05:00
|
|
|
|
|
2022-05-07 20:31:21 +10:00
|
|
|
|
// Copy of the base class defined in axp20x.h.
|
2023-07-14 17:25:20 -04:00
|
|
|
|
// I'd rather not include axp20x.h as it brings Wire dependency.
|
2022-05-07 20:31:21 +10:00
|
|
|
|
class HasBatteryLevel
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Battery state of charge, from 0 to 100 or -1 for unknown
|
|
|
|
|
|
*/
|
2022-09-06 15:58:33 +08:00
|
|
|
|
virtual int getBatteryPercent() { return -1; }
|
2022-05-07 20:31:21 +10:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* The raw voltage of the battery or NAN if unknown
|
|
|
|
|
|
*/
|
2023-05-16 02:43:00 -04:00
|
|
|
|
virtual uint16_t getBattVoltage() { return 0; }
|
2022-05-07 20:31:21 +10:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* return true if there is a battery installed in this unit
|
|
|
|
|
|
*/
|
|
|
|
|
|
virtual bool isBatteryConnect() { return false; }
|
|
|
|
|
|
|
2022-09-06 15:58:33 +08:00
|
|
|
|
virtual bool isVbusIn() { return false; }
|
|
|
|
|
|
virtual bool isCharging() { return false; }
|
2021-03-14 19:00:20 -07:00
|
|
|
|
};
|
2020-08-12 17:03:36 -07:00
|
|
|
|
#endif
|
|
|
|
|
|
|
2020-06-27 21:19:49 -07:00
|
|
|
|
bool pmu_irq = false;
|
|
|
|
|
|
|
|
|
|
|
|
Power *power;
|
|
|
|
|
|
|
2020-08-25 12:48:47 -07:00
|
|
|
|
using namespace meshtastic;
|
|
|
|
|
|
|
2021-07-24 19:44:27 +02:00
|
|
|
|
#ifndef AREF_VOLTAGE
|
2022-07-31 07:11:47 -05:00
|
|
|
|
#if defined(ARCH_NRF52)
|
2020-10-16 17:00:27 +08:00
|
|
|
|
/*
|
|
|
|
|
|
* Internal Reference is +/-0.6V, with an adjustable gain of 1/6, 1/5, 1/4,
|
|
|
|
|
|
* 1/3, 1/2 or 1, meaning 3.6, 3.0, 2.4, 1.8, 1.2 or 0.6V for the ADC levels.
|
|
|
|
|
|
*
|
|
|
|
|
|
* External Reference is VDD/4, with an adjustable gain of 1, 2 or 4, meaning
|
|
|
|
|
|
* VDD/4, VDD/2 or VDD for the ADC levels.
|
|
|
|
|
|
*
|
|
|
|
|
|
* Default settings are internal reference with 1/6 gain (GND..3.6V ADC range)
|
|
|
|
|
|
*/
|
|
|
|
|
|
#define AREF_VOLTAGE 3.6
|
|
|
|
|
|
#else
|
|
|
|
|
|
#define AREF_VOLTAGE 3.3
|
|
|
|
|
|
#endif
|
2021-07-24 19:44:27 +02:00
|
|
|
|
#endif
|
2020-10-16 17:00:27 +08:00
|
|
|
|
|
2020-08-12 17:03:36 -07:00
|
|
|
|
/**
|
|
|
|
|
|
* If this board has a battery level sensor, set this to a valid implementation
|
|
|
|
|
|
*/
|
|
|
|
|
|
static HasBatteryLevel *batteryLevel; // Default to NULL for no battery level sensor
|
|
|
|
|
|
|
2024-09-25 20:51:11 +02:00
|
|
|
|
#ifdef BATTERY_PIN
|
|
|
|
|
|
|
2024-08-21 16:53:12 -07:00
|
|
|
|
static void adcEnable()
|
|
|
|
|
|
{
|
|
|
|
|
|
#ifdef ADC_CTRL // enable adc voltage divider when we need to read
|
|
|
|
|
|
#ifdef ADC_USE_PULLUP
|
|
|
|
|
|
pinMode(ADC_CTRL, INPUT_PULLUP);
|
2024-11-02 04:12:41 +08:00
|
|
|
|
#else
|
|
|
|
|
|
#ifdef HELTEC_V3
|
2024-11-01 15:17:25 -05:00
|
|
|
|
pinMode(ADC_CTRL, INPUT);
|
|
|
|
|
|
uint8_t adc_ctl_enable_value = !(digitalRead(ADC_CTRL));
|
2024-11-02 04:12:41 +08:00
|
|
|
|
pinMode(ADC_CTRL, OUTPUT);
|
|
|
|
|
|
digitalWrite(ADC_CTRL, adc_ctl_enable_value);
|
2024-08-21 16:53:12 -07:00
|
|
|
|
#else
|
|
|
|
|
|
pinMode(ADC_CTRL, OUTPUT);
|
|
|
|
|
|
digitalWrite(ADC_CTRL, ADC_CTRL_ENABLED);
|
2024-11-02 04:12:41 +08:00
|
|
|
|
#endif
|
2024-08-21 16:53:12 -07:00
|
|
|
|
#endif
|
|
|
|
|
|
delay(10);
|
|
|
|
|
|
#endif
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void adcDisable()
|
|
|
|
|
|
{
|
|
|
|
|
|
#ifdef ADC_CTRL // disable adc voltage divider when we need to read
|
|
|
|
|
|
#ifdef ADC_USE_PULLUP
|
|
|
|
|
|
pinMode(ADC_CTRL, INPUT_PULLDOWN);
|
2024-11-02 04:12:41 +08:00
|
|
|
|
#else
|
|
|
|
|
|
#ifdef HELTEC_V3
|
2024-11-01 15:17:25 -05:00
|
|
|
|
pinMode(ADC_CTRL, ANALOG);
|
2024-08-21 16:53:12 -07:00
|
|
|
|
#else
|
|
|
|
|
|
digitalWrite(ADC_CTRL, !ADC_CTRL_ENABLED);
|
|
|
|
|
|
#endif
|
|
|
|
|
|
#endif
|
2024-11-02 04:12:41 +08:00
|
|
|
|
#endif
|
2024-08-21 16:53:12 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-25 20:51:11 +02:00
|
|
|
|
#endif
|
|
|
|
|
|
|
2020-08-12 17:03:36 -07:00
|
|
|
|
/**
|
|
|
|
|
|
* A simple battery level sensor that assumes the battery voltage is attached via a voltage-divider to an analog input
|
|
|
|
|
|
*/
|
|
|
|
|
|
class AnalogBatteryLevel : public HasBatteryLevel
|
2020-06-27 21:19:49 -07:00
|
|
|
|
{
|
2024-09-25 20:34:53 +10:00
|
|
|
|
public:
|
2020-08-12 17:03:36 -07:00
|
|
|
|
/**
|
|
|
|
|
|
* Battery state of charge, from 0 to 100 or -1 for unknown
|
|
|
|
|
|
*/
|
2022-09-06 15:58:33 +08:00
|
|
|
|
virtual int getBatteryPercent() override
|
2020-08-12 17:03:36 -07:00
|
|
|
|
{
|
2025-04-28 18:35:13 -05:00
|
|
|
|
#if defined(HAS_RAKPROT) && !defined(HAS_PMU)
|
2024-06-16 14:24:36 +08:00
|
|
|
|
if (hasRAK()) {
|
|
|
|
|
|
return rak9154Sensor.getBusBatteryPercent();
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2021-03-14 19:00:20 -07:00
|
|
|
|
float v = getBattVoltage();
|
2020-08-12 17:03:36 -07:00
|
|
|
|
|
2020-10-18 09:44:29 +08:00
|
|
|
|
if (v < noBatVolt)
|
2020-08-27 14:46:59 -07:00
|
|
|
|
return -1; // If voltage is super low assume no battery installed
|
2020-08-12 17:03:36 -07:00
|
|
|
|
|
2024-02-16 13:09:57 +01:00
|
|
|
|
#ifdef NO_BATTERY_LEVEL_ON_CHARGE
|
2021-08-10 09:23:26 +02:00
|
|
|
|
// This does not work on a RAK4631 with battery connected
|
2020-10-18 09:44:29 +08:00
|
|
|
|
if (v > chargingVolt)
|
|
|
|
|
|
return 0; // While charging we can't report % full on the battery
|
2021-08-10 09:23:26 +02:00
|
|
|
|
#endif
|
2024-02-16 13:09:57 +01:00
|
|
|
|
/**
|
|
|
|
|
|
* @brief Battery voltage lookup table interpolation to obtain a more
|
|
|
|
|
|
* precise percentage rather than the old proportional one.
|
|
|
|
|
|
* @author Gabriele Russo
|
|
|
|
|
|
* @date 06/02/2024
|
|
|
|
|
|
*/
|
|
|
|
|
|
float battery_SOC = 0.0;
|
|
|
|
|
|
uint16_t voltage = v / NUM_CELLS; // single cell voltage (average)
|
|
|
|
|
|
for (int i = 0; i < NUM_OCV_POINTS; i++) {
|
|
|
|
|
|
if (OCV[i] <= voltage) {
|
|
|
|
|
|
if (i == 0) {
|
|
|
|
|
|
battery_SOC = 100.0; // 100% full
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// interpolate between OCV[i] and OCV[i-1]
|
|
|
|
|
|
battery_SOC = (float)100.0 / (NUM_OCV_POINTS - 1.0) *
|
|
|
|
|
|
(NUM_OCV_POINTS - 1.0 - i + ((float)voltage - OCV[i]) / (OCV[i - 1] - OCV[i]));
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return clamp((int)(battery_SOC), 0, 100);
|
2020-08-12 17:03:36 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2020-08-13 11:23:27 -07:00
|
|
|
|
* The raw voltage of the batteryin millivolts or NAN if unknown
|
2020-08-12 17:03:36 -07:00
|
|
|
|
*/
|
2023-05-16 02:43:00 -04:00
|
|
|
|
virtual uint16_t getBattVoltage() override
|
2020-08-12 17:03:36 -07:00
|
|
|
|
{
|
2021-03-14 19:00:20 -07:00
|
|
|
|
|
2025-04-28 18:35:13 -05:00
|
|
|
|
#if HAS_TELEMETRY && defined(HAS_RAKPROT) && !defined(HAS_PMU) && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
2024-06-16 14:24:36 +08:00
|
|
|
|
if (hasRAK()) {
|
|
|
|
|
|
return getRAKVoltage();
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2025-07-02 12:01:45 +01:00
|
|
|
|
#if HAS_TELEMETRY && !defined(HAS_PMU) && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
2023-06-02 06:32:34 -05:00
|
|
|
|
if (hasINA()) {
|
|
|
|
|
|
return getINAVoltage();
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2021-03-14 19:00:20 -07:00
|
|
|
|
#ifndef ADC_MULTIPLIER
|
|
|
|
|
|
#define ADC_MULTIPLIER 2.0
|
2022-05-07 20:31:21 +10:00
|
|
|
|
#endif
|
2021-03-14 19:00:20 -07:00
|
|
|
|
|
2022-12-05 16:40:23 +01:00
|
|
|
|
#ifndef BATTERY_SENSE_SAMPLES
|
2024-01-29 12:14:21 +00:00
|
|
|
|
#define BATTERY_SENSE_SAMPLES \
|
2024-02-16 13:09:57 +01:00
|
|
|
|
15 // Set the number of samples, it has an effect of increasing sensitivity in complex electromagnetic environment.
|
2022-12-05 16:40:23 +01:00
|
|
|
|
#endif
|
|
|
|
|
|
|
2020-08-12 17:03:36 -07:00
|
|
|
|
#ifdef BATTERY_PIN
|
2022-05-01 14:21:30 -05:00
|
|
|
|
// Override variant or default ADC_MULTIPLIER if we have the override pref
|
2023-01-21 14:34:29 +01:00
|
|
|
|
float operativeAdcMultiplier =
|
|
|
|
|
|
config.power.adc_multiplier_override > 0 ? config.power.adc_multiplier_override : ADC_MULTIPLIER;
|
2022-05-07 20:31:21 +10:00
|
|
|
|
// Do not call analogRead() often.
|
2021-03-14 19:00:20 -07:00
|
|
|
|
const uint32_t min_read_interval = 5000;
|
2024-11-13 05:13:55 -05:00
|
|
|
|
if (!initial_read_done || !Throttle::isWithinTimespanMs(last_read_time_ms, min_read_interval)) {
|
2021-03-14 19:00:20 -07:00
|
|
|
|
last_read_time_ms = millis();
|
2022-07-30 20:12:28 +08:00
|
|
|
|
|
|
|
|
|
|
uint32_t raw = 0;
|
2024-01-29 12:14:21 +00:00
|
|
|
|
float scaled = 0;
|
|
|
|
|
|
|
2024-08-21 16:53:12 -07:00
|
|
|
|
adcEnable();
|
2024-01-29 12:14:21 +00:00
|
|
|
|
#ifdef ARCH_ESP32 // ADC block for espressif platforms
|
|
|
|
|
|
raw = espAdcRead();
|
|
|
|
|
|
scaled = esp_adc_cal_raw_to_voltage(raw, adc_characs);
|
|
|
|
|
|
scaled *= operativeAdcMultiplier;
|
2024-08-21 16:53:12 -07:00
|
|
|
|
#else // block for all other platforms
|
2023-05-16 01:40:42 -04:00
|
|
|
|
for (uint32_t i = 0; i < BATTERY_SENSE_SAMPLES; i++) {
|
|
|
|
|
|
raw += analogRead(BATTERY_PIN);
|
|
|
|
|
|
}
|
2023-01-21 14:34:29 +01:00
|
|
|
|
raw = raw / BATTERY_SENSE_SAMPLES;
|
2024-01-29 12:14:21 +00:00
|
|
|
|
scaled = operativeAdcMultiplier * ((1000 * AREF_VOLTAGE) / pow(2, BATTERY_SENSE_RESOLUTION_BITS)) * raw;
|
|
|
|
|
|
#endif
|
2024-08-21 16:53:12 -07:00
|
|
|
|
adcDisable();
|
2024-05-03 00:14:44 +12:00
|
|
|
|
|
|
|
|
|
|
if (!initial_read_done) {
|
|
|
|
|
|
// Flush the smoothing filter with an ADC reading, if the reading is plausibly correct
|
|
|
|
|
|
if (scaled > last_read_value)
|
|
|
|
|
|
last_read_value = scaled;
|
|
|
|
|
|
initial_read_done = true;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// Already initialized - filter this reading
|
|
|
|
|
|
last_read_value += (scaled - last_read_value) * 0.5; // Virtual LPF
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-10-14 06:11:43 +02:00
|
|
|
|
// LOG_DEBUG("battery gpio %d raw val=%u scaled=%u filtered=%u", BATTERY_PIN, raw, (uint32_t)(scaled), (uint32_t)
|
2024-02-16 13:09:57 +01:00
|
|
|
|
// (last_read_value));
|
2021-03-14 19:00:20 -07:00
|
|
|
|
}
|
2024-02-16 13:09:57 +01:00
|
|
|
|
return last_read_value;
|
2023-05-13 20:38:37 -04:00
|
|
|
|
#endif // BATTERY_PIN
|
2024-01-29 12:14:21 +00:00
|
|
|
|
return 0;
|
2020-08-12 17:03:36 -07:00
|
|
|
|
}
|
2020-06-27 21:19:49 -07:00
|
|
|
|
|
2024-01-29 12:14:21 +00:00
|
|
|
|
#if defined(ARCH_ESP32) && !defined(HAS_PMU) && defined(BATTERY_PIN)
|
|
|
|
|
|
/**
|
|
|
|
|
|
* ESP32 specific function for getting calibrated ADC reads
|
|
|
|
|
|
*/
|
|
|
|
|
|
uint32_t espAdcRead()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t raw = 0;
|
2024-02-16 13:09:57 +01:00
|
|
|
|
uint8_t raw_c = 0; // raw reading counter
|
2024-01-29 12:14:21 +00:00
|
|
|
|
|
|
|
|
|
|
#ifndef BAT_MEASURE_ADC_UNIT // ADC1
|
|
|
|
|
|
for (int i = 0; i < BATTERY_SENSE_SAMPLES; i++) {
|
2024-02-16 13:09:57 +01:00
|
|
|
|
int val_ = adc1_get_raw(adc_channel);
|
|
|
|
|
|
if (val_ >= 0) { // save only valid readings
|
|
|
|
|
|
raw += val_;
|
|
|
|
|
|
raw_c++;
|
|
|
|
|
|
}
|
|
|
|
|
|
// delayMicroseconds(100);
|
2024-01-29 12:14:21 +00:00
|
|
|
|
}
|
2024-08-21 16:53:12 -07:00
|
|
|
|
#else // ADC2
|
2024-02-14 05:20:48 +13:00
|
|
|
|
#ifdef CONFIG_IDF_TARGET_ESP32S3 // ESP32S3
|
|
|
|
|
|
// ADC2 wifi bug workaround not required, breaks compile
|
|
|
|
|
|
// On ESP32S3, ADC2 can take turns with Wifi (?)
|
|
|
|
|
|
|
|
|
|
|
|
int32_t adc_buf;
|
|
|
|
|
|
esp_err_t read_result;
|
|
|
|
|
|
|
|
|
|
|
|
// Multiple samples
|
|
|
|
|
|
for (int i = 0; i < BATTERY_SENSE_SAMPLES; i++) {
|
|
|
|
|
|
adc_buf = 0;
|
|
|
|
|
|
read_result = -1;
|
|
|
|
|
|
|
|
|
|
|
|
read_result = adc2_get_raw(adc_channel, ADC_WIDTH_BIT_12, &adc_buf);
|
|
|
|
|
|
if (read_result == ESP_OK) {
|
|
|
|
|
|
raw += adc_buf;
|
|
|
|
|
|
raw_c++; // Count valid samples
|
|
|
|
|
|
} else {
|
2024-10-14 06:11:43 +02:00
|
|
|
|
LOG_DEBUG("An attempt to sample ADC2 failed");
|
2024-02-14 05:20:48 +13:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-02-16 13:09:57 +01:00
|
|
|
|
#else // Other ESP32
|
2024-01-29 12:14:21 +00:00
|
|
|
|
int32_t adc_buf = 0;
|
|
|
|
|
|
for (int i = 0; i < BATTERY_SENSE_SAMPLES; i++) {
|
|
|
|
|
|
// ADC2 wifi bug workaround, see
|
|
|
|
|
|
// https://github.com/espressif/arduino-esp32/issues/102
|
|
|
|
|
|
WRITE_PERI_REG(SENS_SAR_READ_CTRL2_REG, RTC_reg_b);
|
|
|
|
|
|
SET_PERI_REG_MASK(SENS_SAR_READ_CTRL2_REG, SENS_SAR2_DATA_INV);
|
|
|
|
|
|
adc2_get_raw(adc_channel, ADC_WIDTH_BIT_12, &adc_buf);
|
|
|
|
|
|
raw += adc_buf;
|
2024-02-14 05:20:48 +13:00
|
|
|
|
raw_c++;
|
2024-01-29 12:14:21 +00:00
|
|
|
|
}
|
2024-02-16 13:09:57 +01:00
|
|
|
|
#endif // BAT_MEASURE_ADC_UNIT
|
2024-02-14 05:20:48 +13:00
|
|
|
|
|
|
|
|
|
|
#endif // End BAT_MEASURE_ADC_UNIT
|
|
|
|
|
|
return (raw / (raw_c < 1 ? 1 : raw_c));
|
2024-01-29 12:14:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2020-08-12 17:03:36 -07:00
|
|
|
|
/**
|
|
|
|
|
|
* return true if there is a battery installed in this unit
|
|
|
|
|
|
*/
|
2024-10-26 12:03:28 +02:00
|
|
|
|
// if we have a integrated device with a battery, we can assume that the battery is always connected
|
|
|
|
|
|
#ifdef BATTERY_IMMUTABLE
|
|
|
|
|
|
virtual bool isBatteryConnect() override { return true; }
|
2025-04-07 12:46:22 +02:00
|
|
|
|
#elif defined(ADC_V)
|
|
|
|
|
|
virtual bool isBatteryConnect() override
|
|
|
|
|
|
{
|
|
|
|
|
|
int lastReading = digitalRead(ADC_V);
|
|
|
|
|
|
// 判断值是否变化
|
|
|
|
|
|
for (int i = 2; i < 500; i++) {
|
|
|
|
|
|
int reading = digitalRead(ADC_V);
|
|
|
|
|
|
if (reading != lastReading) {
|
|
|
|
|
|
return false; // 有变化,USB供电, 没接电池
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
2024-10-26 12:03:28 +02:00
|
|
|
|
#else
|
2023-08-17 20:22:34 -05:00
|
|
|
|
virtual bool isBatteryConnect() override { return getBatteryPercent() != -1; }
|
2024-10-26 12:03:28 +02:00
|
|
|
|
#endif
|
2020-10-18 09:44:29 +08:00
|
|
|
|
|
|
|
|
|
|
/// If we see a battery voltage higher than physics allows - assume charger is pumping
|
|
|
|
|
|
/// in power
|
2023-03-31 13:43:42 +03:00
|
|
|
|
/// On some boards we don't have the power management chip (like AXPxxxx)
|
|
|
|
|
|
/// so we use EXT_PWR_DETECT GPIO pin to detect external power source
|
2023-01-21 14:34:29 +01:00
|
|
|
|
virtual bool isVbusIn() override
|
|
|
|
|
|
{
|
2023-03-31 13:43:42 +03:00
|
|
|
|
#ifdef EXT_PWR_DETECT
|
2025-03-21 16:12:49 +01:00
|
|
|
|
#if defined(HELTEC_CAPSULE_SENSOR_V3) || defined(HELTEC_SENSOR_HUB)
|
2024-06-16 16:29:45 +02:00
|
|
|
|
// if external powered that pin will be pulled down
|
|
|
|
|
|
if (digitalRead(EXT_PWR_DETECT) == LOW) {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
// if it's not LOW - check the battery
|
|
|
|
|
|
#else
|
|
|
|
|
|
// if external powered that pin will be pulled up
|
|
|
|
|
|
if (digitalRead(EXT_PWR_DETECT) == HIGH) {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
// if it's not HIGH - check the battery
|
|
|
|
|
|
#endif
|
2023-03-31 13:43:42 +03:00
|
|
|
|
#endif
|
2023-01-21 14:34:29 +01:00
|
|
|
|
return getBattVoltage() > chargingVolt;
|
|
|
|
|
|
}
|
2020-10-18 09:44:29 +08:00
|
|
|
|
|
|
|
|
|
|
/// Assume charging if we have a battery and external power is connected.
|
|
|
|
|
|
/// we can't be smart enough to say 'full'?
|
2024-03-12 17:55:31 +01:00
|
|
|
|
virtual bool isCharging() override
|
|
|
|
|
|
{
|
2025-04-28 18:35:13 -05:00
|
|
|
|
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && defined(HAS_RAKPROT) && !defined(HAS_PMU)
|
2024-06-16 14:24:36 +08:00
|
|
|
|
if (hasRAK()) {
|
|
|
|
|
|
return (rak9154Sensor.isCharging()) ? OptTrue : OptFalse;
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
2024-03-12 17:55:31 +01:00
|
|
|
|
#ifdef EXT_CHRG_DETECT
|
|
|
|
|
|
return digitalRead(EXT_CHRG_DETECT) == ext_chrg_detect_value;
|
|
|
|
|
|
#else
|
2025-07-02 12:01:45 +01:00
|
|
|
|
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && !defined(DISABLE_INA_CHARGING_DETECTION)
|
Detect charging status by measuring current flow with configured INA battery sensor (#5271)
* INA219 charging detection
minimal implementation: if there is a configured INA219 sensor for battery monitoring we can take the current flow across the shunt resistor to know if we are charging the battery - negative milliamps indicate charging
* Update Power.cpp
added comments and 2 extra defines to disable and swap detection direction
* Update Power.cpp
fix disabled case
* move getCurrentMa() to new CurrentSensor class
* INA219 charging detection
minimal implementation: if there is a configured INA219 sensor for battery monitoring we can take the current flow across the shunt resistor to know if we are charging the battery - negative milliamps indicate charging
* Update Power.cpp
added comments and 2 extra defines to disable and swap detection direction
* Update Power.cpp
fix disabled case
* move getCurrentMa() to new CurrentSensor class
* add INA3221 charging detection
* RP2040: Update core; add mDNS support (#5355)
* Update arduino-pico core
* RP2040: Add mDNS support
* SimpleMDNS `begin` now returns a bool
* Add `-g` option to `debug_build_flags` to link files for gdb
* RAK11310 needs old platform as well
* Change defines to specific architecture
* Core version 4.2.1 is out
* Add sudo to apt-get commands for Raspbian Build (#5364)
Without sudo, inadequate permissions to runs the commands meant
the build was failing.
* Typo fix in build_raspbian.yml (#5365)
s/sudp/sudo :(:(:(
* Rework some things
* Trunk
* Separate littlefs bundle
* version tags
* Diag
* Add littlefswebui
* Bug fixed in ExternalNotificationModule (#5375)
While `nagging` setExternalState wasn't written to Buzzer & Vibra so output was never toggled.
Possible fix for #5348
* Cleanup static files from bad Web UI bundle on 2.5.13 release (#5376)
* Cleanup static files from bad Web UI bundle on 2.5.13 release
* Check existence first
* Esp32 is the only one we care about
* Move some actions to after `startTransmit()` (#5383)
To minimize the time between channel scan and actual transmit
* [create-pull-request] automated change (#5380)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Allows all 3 PKI keys to be added to userPrefs.h (#4969) and a tool. (#5368)
* more userPrefs.h
Added PKI Admin keys to userPrefs.h
* Update userPrefs.h
Allows all 3 PKI keys to be added to userPrefs.h (#4969)
* Update NodeDB.cpp
Trunk
* Update userPrefs.h
Changed wording
* Create base64_to_hex.py
A little tool for converting base64 PKI Keys to decoded byte that userPrefs.h can understand.
* more userPrefs.h
Added PKI Admin keys to userPrefs.h
* Update userPrefs.h
Allows all 3 PKI keys to be added to userPrefs.h (#4969)
* Update NodeDB.cpp
Trunk
* Update userPrefs.h
Changed wording
* Create base64_to_hex.py
A little tool for converting base64 PKI Keys to decoded byte that userPrefs.h can understand.
* [create-pull-request] automated change (#5388)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* add smiley emoji (#5391)
* add smiley emoji
* clang-formatted
* Anable trace route function on wismeshtap platform (#5389)
* fix 'symbal' typo (#5395)
* [create-pull-request] automated change (#5399)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* /api/v1/fromradio: add OPTIONS handler for CORS. (#5386)
This avoids hitting the 404 Not Found handler, which breaks connection
keep-alive, so this change fixes a big performance regression for Web Client in
Chrome: https://github.com/meshtastic/firmware/issues/5385
Tested on Heltec V3.
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Make heart emoji usable (#5403)
* Create a specific hw_model for WisMesh Tap (#5400)
* Create a specific hw_model for WisMesh Tap
* Trunk
* HAS_ETHERNET
* Remove it altogether
* Don't need these either
* Fix RTC time injection and consolidate position logic (#5396)
* Fix RTC time injection and consolidate position logic
* Comment out unused var warning
* Backerds
* Update arduino-pico core to fix sporadic hangs (#5406)
* Update platform-raspberrypi also (#5407)
* Update arduino-pico core to fix sporadic hangs
* Update platform-raspberrypi also
* --web added to device-install(.sh/.bat) (#5405)
* Add --web
* Update device-install.bat
Forgot a "-" a few places.
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* add GPS in indicator board (#5411)
* Fixed NMEA sentence issue in CalTopo as well as bug with no printing all of the nodes (#5412)
* --web littlefswebui-* typo fix (#5416)
* Add --web
* Update device-install.bat
Forgot a "-" a few places.
* Typo fix.
* Typo fix
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: GUVWAF <78759985+GUVWAF@users.noreply.github.com>
* Temporarily disable MDNS when MQTT is enabled (#5418)
Leads to a panic
* Check for OkToMqtt flag presence before uplinking to MQTT (#5413)
* Check for oktomqtt flag presence before uplinking to MQTT
* Move to mqtt->onSend
* Temetry can respond to want-response for LocalStats variant (#5414)
* Seems like the last DIY board that's not "extra" (#5420)
* Cherry pick tdeck fixes (#5422)
* Try-fix (workaround) T-Deck audio crash
* set T-Deck audio to unused 48 (mem mclk)
* swap mclk to gpio 21
* dreamcatcher: assign GPIO44 to audio mclk
---------
Co-authored-by: mverch67 <manuel.verch@gmx.de>
* add canned message and keyboard in indicator board (#5410)
* add canned message and keyboard in indicator board
* Added virtual keyboard macro and enabled for Indicator
* Cleanup macros by applying USE_VIRTUAL_KEYBOARD and DISPLAY_CLOCK_FRAME
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Update build-native.sh (#5415)
* Update build-native.sh
Device-install.sh and device-update.sh are not used on native platform, skip copying to release directory after build and copy native-install.sh and native-run.sh instead.
* Update build-native.sh
Skip native-run.sh copy
* Cleans up visibility in GPS.h (#5426)
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
* Fix admin key loading from userPrefs.h (#5417)
* 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
* Fix warning: extra tokens at end of #endif directive.
* Fix antenna switching logic. Complementary-pin control logic is required on the rp2040-lora board.
* Fix deprecated macros.
* Set RP2040 in dormant mode when deep sleep is triggered.
* Fix array out of bounds read.
* Admin key count needs to be set otherwise the key will be zero loaded after reset.
* Don't reset the admin key size when loading defaults. Preserve an existing key in config if possible.
* Remove log spam when reading INA voltage sensor.
* Remove static declaration for admin keys from userPrefs.h. Load hard coded admin keys in case config file has empty slots.
* Removed newlines from log.
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
* try to detect dfrobot station to tell it apart from an ublox gps. (#5393)
* Remove BMA-423 and STK8X by default (#5429)
* Remove BMA-423 by default
* STK
* Wrong macro
* Helps if you include the file
* [create-pull-request] automated change (#5431)
Co-authored-by: caveman99 <25002+caveman99@users.noreply.github.com>
* Support for the ClimateGuard RadSens Geiger-Muller tube (#5425)
* fixes https://github.com/meshtastic/firmware/issues/5434 (#5435)
* update libpax
* fix interval init
* Fix memory leaks by adding missing `free()` calls before early returns in `MQTT::onReceive` (#5439)
This fix addresses memory leaks in the `MQTT::onReceive` function by ensuring that dynamically allocated resources (`e.channel_id`, `e.gateway_id` and `e.packet`) are properly freed before each early return. Previously, these resources were only freed at the end of the function, leaving them unhandled in certain exit paths. Adding the missing `free()` calls prevents memory leaks and ensures proper resource cleanup in all scenarios.
* Removing 1.0 legacy boards from releases and completely removing Heltec wireless capsule from support (#5436)
Co-authored-by: Tom Fifield <tom@tomfifield.net>
* A second round of cleanup on GPS.h. (#5433)
* Move yet more stuff out of GPS.h and into file scope.
* Protect code macros from eating semicolons.
* Remove unused (and unimplemented) getDOPString.
* clang-format with project style file on affected files.
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
* enable MQTT with TLS on RPi picow (#5442)
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Don't powersave on Wifi (#5443)
* Don't go into light sleep with wifi enabled
* Move
* Trunk
* Revert "Seems like the last DIY board that's not "extra" (#5420)" (#5446)
This reverts commit e6fb6b115aebb12b31fb93ed9d1508a6109b2f03.
* Actually gunzip all the files when building a .deb (#5449)
* [create-pull-request] automated change (#5457)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Cleanup i2c scan logs and macro to save some bytes and remain consistent (#5455)
* Cleanup i2c scan logs and macro to save some bytes and remain consistent
* Functions are better than macros
* Exclude i2c scan for STM32
* Useless log
* Clean up some inline functions (#5454)
* Use isWithinTimespanMs to avoid refererence to NodeDb instance inside of NodeDb (#5453)
* fix cors for meshtasticd to allow use of cross origin clients (#5463)
* Remove ATECC crypto chip placeholder code (#5461)
* GPS.h cleanups round 3. (#5447)
* GPS.h cleanups round 3.
No effective behavior change.
Protected members can be private so make it so. (Supporting
subclasses needs a lot more work.)
Moves uBloxGnssModelInfo into file scope.
Moves uBloxProtocolVersion into uBloxGnssModelInfo.
Moves baud rate arrays into file scope.
Removes unused/ unimplemented powerStateToString.
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
* Trunk Format.
---------
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
Co-authored-by: Tom Fifield <tom@tomfifield.net>
* Fix ukrainian fonts (#5468)
* FIX: rollback to !4624
* UPDATE: new 16 and 24 UA Fonts and fixes
* fix: Solve the lightsleep crash problem via disable lightsleep for indicator. (#5470)
* Trunk
* Warnings and log cleanup (#5472)
* Don't log if keyboard not found
* Signed comparison issue
* [create-pull-request] automated change (#5475)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Adds libusb dev package to Raspbian build steps (#5480)
* [create-pull-request] automated change (#5478)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Portduino fixes (#5479)
* Set config.yaml defaults even if General is missing
* Unsigned values should get %u in logging
* Update arduino-pico core and remove MDNS restriction (#5483)
* Update xiao_esp32 fully support L67K (#5488)
L67K module hardware changed
* Convert userprefs to a json file instead of header file which has to be included everywhere (#5471)
* WIP
* Got string quoting and macro expansion working
* Need the placeholder
* Cleanup
* Missed a user prefs reference
* Update jsonc
* SimRadio: clean-up and emulate collisions (#5487)
* Clean up SimRadio and don't let it use PKC
* Add collision emulation for SimRadio
* Add stats from SimRadio to LocalStats
* Make emulating collisions optional
* add nodeId to nodeinfo update log lines and removed redundant nodeinfo update log line (#5493)
* Refact the macro definition of GPS initialization of GPSDEFAULTD_NOT_PRESENT and added seeeed Indicator to this sequence (#5494)
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Extend Length of Source and Destination Node IDs Logged (#5492)
* show 8 chars for logging source and destination ids
* extend legnth of source and destination nodes in log
* Added femtofox configs (#5477)
* added femtofox configs
* Rename bin/config.d/femtofox_Waveshare-SX126X-XXXM_AI-Thinker-RA-01SH.yaml to bin/config.d/femtofox/femtofox_Waveshare-SX126X-XXXM_AI-Thinker-RA-01SH.yaml
* moved femtofox configs to subdir
* [Add] LR1110, LR1120 and LR1121 to linux native Portduino (#5496)
* Update main.cpp
* Update PortduinoGlue.h
* Update PortduinoGlue.cpp
* Update PortduinoGlue.cpp
* Update PortduinoGlue.cpp
* Update main.cpp
* [create-pull-request] automated change (#5500)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Fix minor typos in package workflows (#5505)
* Don't use channel index for encrypted packet (#5509)
* Don't use channel index for encrypted packet
* Remove assert in `getKey`, set invalid key length
So encrypting will fail without reboot
* Reset channel to 0 when unable to encrypt
Such that the NAK doesn't use the failing channel hash
* Always Announce MDNS meshtastic service (#5503)
* refactor server api port into define
* always announce MDNS meshtastic service
* fix nodeDB erase loop when free mem returns invalid value (0, -1). (#5519)
Co-authored-by: mverch67 <manuel.verch@gmx.de>
* Add heltec capsule back
* Revert "Add heltec capsule back"
This reverts commit fc16d9342116235fa86cf6ac163b17125bb4b50e.
* Lets try this again minus device ui
* Add popular nrf52 pro micro to the builds (#5523)
* Add MACAddress to config.yaml (#5506)
* Add MACAddress to config.yaml
* Better error handling on native, including failing to launch with blank MAC Address and real hardware.
* Re-arrange Mac Address handling and add MACAddressSource
* Bump portduino to remove macaddr function there
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Configure Seeed Xiao S3 RX enable pin (#5517)
* Create OpenWRT_One_mikroBUS_sx1262.yaml (#5529)
* tlora_v2_1_16: Unset BUTTON_PIN and BUTTON_NEED_PULLUP (#5535)
Unset BUTTON_PIN and BUTTON_NEED_PULLUP as the board ships without a user button.
Devices and users expecting a button on GPIO12 have to set [GPIO for user button](https://meshtastic.org/docs/configuration/radio/device/#gpio-for-user-button) to 12 (or any GPIO pin the momentary switch was connected to) to restore functionality.
Signed-off-by: Andrew Yong <me@ndoo.sg>
* [create-pull-request] automated change (#5530)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Fix detection for some RadSens hardware versions (#5542)
Co-authored-by: Jake-B <jake-b@users.noreply.github.com>
* Initialize dmac array to nulls (#5538)
* Initialize dmac array to nulls
* Use std::cout for print before console is init.
* Update OpenWRT_One_mikroBUS_sx1262.yaml (#5544)
* Add portduino-buildroot variant (#5540)
* Add portduino-buildroot variant
* Update platform-native for platform-buildroot
* portduino-buildroot: Define c standard (#5547)
* Portduino: Move meshtasticd/web out of /usr/share/doc/ (#5548)
* Portduino: fix transitional symlinks (#5550)
* Windows Support - Trunk and Platformio (#5397) (#5518)
* Add support for GPG
* Add usb device support
* Add trunk.io to devcontainer
* Trunk things
* trunk fmt
* formatting
* fix trivy/DS002, checkov/CKV_DOCKER_3
* hide docker extension popup
* fix trivy/DS026, checkov/CKV_DOCKER_2
Co-authored-by: Kalle Lilja <15094562+ThatKalle@users.noreply.github.com>
* Synch minor changes from TFT branch (#5520)
* Synch minor changes from TFT branch
Includes:
* New nordicnrf52 minor version (10.5.0 --> 10.6.0)
* Optimisations for T_DECK
* preparation for MESH_TAB
* add ext notification module to portduino
---------
Co-authored-by: mverch67 <manuel.verch@gmx.de>
* DIO3_TCXO_VOLTAGE in config.yaml can now take an exact voltage (#5558)
* Support TLORA_V3.0 (#5563)
- Support TLORA_V3.0. Update of the legendary 2.1_1.6.1 with solar charger, TCXO and IPEX connector.
- 'extra' some short-lived EOL intermediate boards in that range. If possible use T3S3 instead of all of these!
- update trunk to latest version
* Create OpenWRT-One-mikroBUS-LR-IOT-CLICK.yaml (#5564)
* Portduino: fix setting hwId via argument (#5565)
* INA219 charging detection
minimal implementation: if there is a configured INA219 sensor for battery monitoring we can take the current flow across the shunt resistor to know if we are charging the battery - negative milliamps indicate charging
* Update Power.cpp
added comments and 2 extra defines to disable and swap detection direction
* Trunk Fixes
* Add INA226 support
---------
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
Signed-off-by: Andrew Yong <me@ndoo.sg>
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz>
Co-authored-by: GUVWAF <78759985+GUVWAF@users.noreply.github.com>
Co-authored-by: Tom Fifield <tom@tomfifield.net>
Co-authored-by: Michael Gjelsø <36234524+gjelsoe@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
Co-authored-by: jcyrio <50239349+jcyrio@users.noreply.github.com>
Co-authored-by: Daniel.Cao <144674500+DanielCao0@users.noreply.github.com>
Co-authored-by: Catalin Patulea <cronos586@gmail.com>
Co-authored-by: dylanli <dylan3000dylan@gmail.com>
Co-authored-by: mverch67 <manuel.verch@gmx.de>
Co-authored-by: madeofstown <33820964+madeofstown@users.noreply.github.com>
Co-authored-by: Christopher Hoover <ch@murgatroid.com>
Co-authored-by: Mictronics <github@mictronics.de>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
Co-authored-by: caveman99 <25002+caveman99@users.noreply.github.com>
Co-authored-by: jake-b <1012393+jake-b@users.noreply.github.com>
Co-authored-by: César de Tassis Filho <CTassisF@users.noreply.github.com>
Co-authored-by: Tomas Dubec <tomas.dubec@gmail.com>
Co-authored-by: Liam Cottle <liam@liamcottle.com>
Co-authored-by: panaceya <panaceya@users.noreply.github.com>
Co-authored-by: virgil <virgil.wang.cj@gmail.com>
Co-authored-by: Robert <r@rbrt.io>
Co-authored-by: noon92 <40807970+noon92@users.noreply.github.com>
Co-authored-by: Mark Trevor Birss <markbirss@gmail.com>
Co-authored-by: broglep <20624281+broglep@users.noreply.github.com>
Co-authored-by: Matthias Granberry <matthias.granberry@gmail.com>
Co-authored-by: Andrew Yong <me@ndoo.sg>
Co-authored-by: Jake-B <jake-b@users.noreply.github.com>
Co-authored-by: Austin <vidplace7@gmail.com>
Co-authored-by: Kalle Lilja <15094562+ThatKalle@users.noreply.github.com>
2024-12-22 05:02:50 +01:00
|
|
|
|
if (hasINA()) {
|
|
|
|
|
|
// get current flow from INA sensor - negative value means power flowing into the battery
|
|
|
|
|
|
// default assuming BATTERY+ <--> INA_VIN+ <--> SHUNT RESISTOR <--> INA_VIN- <--> LOAD
|
|
|
|
|
|
LOG_DEBUG("Using INA on I2C addr 0x%x for charging detection", config.power.device_battery_ina_address);
|
|
|
|
|
|
#if defined(INA_CHARGING_DETECTION_INVERT)
|
|
|
|
|
|
return getINACurrent() > 0;
|
|
|
|
|
|
#else
|
|
|
|
|
|
return getINACurrent() < 0;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
}
|
2024-03-12 17:55:31 +01:00
|
|
|
|
return isBatteryConnect() && isVbusIn();
|
Detect charging status by measuring current flow with configured INA battery sensor (#5271)
* INA219 charging detection
minimal implementation: if there is a configured INA219 sensor for battery monitoring we can take the current flow across the shunt resistor to know if we are charging the battery - negative milliamps indicate charging
* Update Power.cpp
added comments and 2 extra defines to disable and swap detection direction
* Update Power.cpp
fix disabled case
* move getCurrentMa() to new CurrentSensor class
* INA219 charging detection
minimal implementation: if there is a configured INA219 sensor for battery monitoring we can take the current flow across the shunt resistor to know if we are charging the battery - negative milliamps indicate charging
* Update Power.cpp
added comments and 2 extra defines to disable and swap detection direction
* Update Power.cpp
fix disabled case
* move getCurrentMa() to new CurrentSensor class
* add INA3221 charging detection
* RP2040: Update core; add mDNS support (#5355)
* Update arduino-pico core
* RP2040: Add mDNS support
* SimpleMDNS `begin` now returns a bool
* Add `-g` option to `debug_build_flags` to link files for gdb
* RAK11310 needs old platform as well
* Change defines to specific architecture
* Core version 4.2.1 is out
* Add sudo to apt-get commands for Raspbian Build (#5364)
Without sudo, inadequate permissions to runs the commands meant
the build was failing.
* Typo fix in build_raspbian.yml (#5365)
s/sudp/sudo :(:(:(
* Rework some things
* Trunk
* Separate littlefs bundle
* version tags
* Diag
* Add littlefswebui
* Bug fixed in ExternalNotificationModule (#5375)
While `nagging` setExternalState wasn't written to Buzzer & Vibra so output was never toggled.
Possible fix for #5348
* Cleanup static files from bad Web UI bundle on 2.5.13 release (#5376)
* Cleanup static files from bad Web UI bundle on 2.5.13 release
* Check existence first
* Esp32 is the only one we care about
* Move some actions to after `startTransmit()` (#5383)
To minimize the time between channel scan and actual transmit
* [create-pull-request] automated change (#5380)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Allows all 3 PKI keys to be added to userPrefs.h (#4969) and a tool. (#5368)
* more userPrefs.h
Added PKI Admin keys to userPrefs.h
* Update userPrefs.h
Allows all 3 PKI keys to be added to userPrefs.h (#4969)
* Update NodeDB.cpp
Trunk
* Update userPrefs.h
Changed wording
* Create base64_to_hex.py
A little tool for converting base64 PKI Keys to decoded byte that userPrefs.h can understand.
* more userPrefs.h
Added PKI Admin keys to userPrefs.h
* Update userPrefs.h
Allows all 3 PKI keys to be added to userPrefs.h (#4969)
* Update NodeDB.cpp
Trunk
* Update userPrefs.h
Changed wording
* Create base64_to_hex.py
A little tool for converting base64 PKI Keys to decoded byte that userPrefs.h can understand.
* [create-pull-request] automated change (#5388)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* add smiley emoji (#5391)
* add smiley emoji
* clang-formatted
* Anable trace route function on wismeshtap platform (#5389)
* fix 'symbal' typo (#5395)
* [create-pull-request] automated change (#5399)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* /api/v1/fromradio: add OPTIONS handler for CORS. (#5386)
This avoids hitting the 404 Not Found handler, which breaks connection
keep-alive, so this change fixes a big performance regression for Web Client in
Chrome: https://github.com/meshtastic/firmware/issues/5385
Tested on Heltec V3.
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Make heart emoji usable (#5403)
* Create a specific hw_model for WisMesh Tap (#5400)
* Create a specific hw_model for WisMesh Tap
* Trunk
* HAS_ETHERNET
* Remove it altogether
* Don't need these either
* Fix RTC time injection and consolidate position logic (#5396)
* Fix RTC time injection and consolidate position logic
* Comment out unused var warning
* Backerds
* Update arduino-pico core to fix sporadic hangs (#5406)
* Update platform-raspberrypi also (#5407)
* Update arduino-pico core to fix sporadic hangs
* Update platform-raspberrypi also
* --web added to device-install(.sh/.bat) (#5405)
* Add --web
* Update device-install.bat
Forgot a "-" a few places.
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* add GPS in indicator board (#5411)
* Fixed NMEA sentence issue in CalTopo as well as bug with no printing all of the nodes (#5412)
* --web littlefswebui-* typo fix (#5416)
* Add --web
* Update device-install.bat
Forgot a "-" a few places.
* Typo fix.
* Typo fix
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: GUVWAF <78759985+GUVWAF@users.noreply.github.com>
* Temporarily disable MDNS when MQTT is enabled (#5418)
Leads to a panic
* Check for OkToMqtt flag presence before uplinking to MQTT (#5413)
* Check for oktomqtt flag presence before uplinking to MQTT
* Move to mqtt->onSend
* Temetry can respond to want-response for LocalStats variant (#5414)
* Seems like the last DIY board that's not "extra" (#5420)
* Cherry pick tdeck fixes (#5422)
* Try-fix (workaround) T-Deck audio crash
* set T-Deck audio to unused 48 (mem mclk)
* swap mclk to gpio 21
* dreamcatcher: assign GPIO44 to audio mclk
---------
Co-authored-by: mverch67 <manuel.verch@gmx.de>
* add canned message and keyboard in indicator board (#5410)
* add canned message and keyboard in indicator board
* Added virtual keyboard macro and enabled for Indicator
* Cleanup macros by applying USE_VIRTUAL_KEYBOARD and DISPLAY_CLOCK_FRAME
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Update build-native.sh (#5415)
* Update build-native.sh
Device-install.sh and device-update.sh are not used on native platform, skip copying to release directory after build and copy native-install.sh and native-run.sh instead.
* Update build-native.sh
Skip native-run.sh copy
* Cleans up visibility in GPS.h (#5426)
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
* Fix admin key loading from userPrefs.h (#5417)
* 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
* Fix warning: extra tokens at end of #endif directive.
* Fix antenna switching logic. Complementary-pin control logic is required on the rp2040-lora board.
* Fix deprecated macros.
* Set RP2040 in dormant mode when deep sleep is triggered.
* Fix array out of bounds read.
* Admin key count needs to be set otherwise the key will be zero loaded after reset.
* Don't reset the admin key size when loading defaults. Preserve an existing key in config if possible.
* Remove log spam when reading INA voltage sensor.
* Remove static declaration for admin keys from userPrefs.h. Load hard coded admin keys in case config file has empty slots.
* Removed newlines from log.
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
* try to detect dfrobot station to tell it apart from an ublox gps. (#5393)
* Remove BMA-423 and STK8X by default (#5429)
* Remove BMA-423 by default
* STK
* Wrong macro
* Helps if you include the file
* [create-pull-request] automated change (#5431)
Co-authored-by: caveman99 <25002+caveman99@users.noreply.github.com>
* Support for the ClimateGuard RadSens Geiger-Muller tube (#5425)
* fixes https://github.com/meshtastic/firmware/issues/5434 (#5435)
* update libpax
* fix interval init
* Fix memory leaks by adding missing `free()` calls before early returns in `MQTT::onReceive` (#5439)
This fix addresses memory leaks in the `MQTT::onReceive` function by ensuring that dynamically allocated resources (`e.channel_id`, `e.gateway_id` and `e.packet`) are properly freed before each early return. Previously, these resources were only freed at the end of the function, leaving them unhandled in certain exit paths. Adding the missing `free()` calls prevents memory leaks and ensures proper resource cleanup in all scenarios.
* Removing 1.0 legacy boards from releases and completely removing Heltec wireless capsule from support (#5436)
Co-authored-by: Tom Fifield <tom@tomfifield.net>
* A second round of cleanup on GPS.h. (#5433)
* Move yet more stuff out of GPS.h and into file scope.
* Protect code macros from eating semicolons.
* Remove unused (and unimplemented) getDOPString.
* clang-format with project style file on affected files.
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
* enable MQTT with TLS on RPi picow (#5442)
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Don't powersave on Wifi (#5443)
* Don't go into light sleep with wifi enabled
* Move
* Trunk
* Revert "Seems like the last DIY board that's not "extra" (#5420)" (#5446)
This reverts commit e6fb6b115aebb12b31fb93ed9d1508a6109b2f03.
* Actually gunzip all the files when building a .deb (#5449)
* [create-pull-request] automated change (#5457)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Cleanup i2c scan logs and macro to save some bytes and remain consistent (#5455)
* Cleanup i2c scan logs and macro to save some bytes and remain consistent
* Functions are better than macros
* Exclude i2c scan for STM32
* Useless log
* Clean up some inline functions (#5454)
* Use isWithinTimespanMs to avoid refererence to NodeDb instance inside of NodeDb (#5453)
* fix cors for meshtasticd to allow use of cross origin clients (#5463)
* Remove ATECC crypto chip placeholder code (#5461)
* GPS.h cleanups round 3. (#5447)
* GPS.h cleanups round 3.
No effective behavior change.
Protected members can be private so make it so. (Supporting
subclasses needs a lot more work.)
Moves uBloxGnssModelInfo into file scope.
Moves uBloxProtocolVersion into uBloxGnssModelInfo.
Moves baud rate arrays into file scope.
Removes unused/ unimplemented powerStateToString.
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
* Trunk Format.
---------
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
Co-authored-by: Tom Fifield <tom@tomfifield.net>
* Fix ukrainian fonts (#5468)
* FIX: rollback to !4624
* UPDATE: new 16 and 24 UA Fonts and fixes
* fix: Solve the lightsleep crash problem via disable lightsleep for indicator. (#5470)
* Trunk
* Warnings and log cleanup (#5472)
* Don't log if keyboard not found
* Signed comparison issue
* [create-pull-request] automated change (#5475)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Adds libusb dev package to Raspbian build steps (#5480)
* [create-pull-request] automated change (#5478)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Portduino fixes (#5479)
* Set config.yaml defaults even if General is missing
* Unsigned values should get %u in logging
* Update arduino-pico core and remove MDNS restriction (#5483)
* Update xiao_esp32 fully support L67K (#5488)
L67K module hardware changed
* Convert userprefs to a json file instead of header file which has to be included everywhere (#5471)
* WIP
* Got string quoting and macro expansion working
* Need the placeholder
* Cleanup
* Missed a user prefs reference
* Update jsonc
* SimRadio: clean-up and emulate collisions (#5487)
* Clean up SimRadio and don't let it use PKC
* Add collision emulation for SimRadio
* Add stats from SimRadio to LocalStats
* Make emulating collisions optional
* add nodeId to nodeinfo update log lines and removed redundant nodeinfo update log line (#5493)
* Refact the macro definition of GPS initialization of GPSDEFAULTD_NOT_PRESENT and added seeeed Indicator to this sequence (#5494)
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Extend Length of Source and Destination Node IDs Logged (#5492)
* show 8 chars for logging source and destination ids
* extend legnth of source and destination nodes in log
* Added femtofox configs (#5477)
* added femtofox configs
* Rename bin/config.d/femtofox_Waveshare-SX126X-XXXM_AI-Thinker-RA-01SH.yaml to bin/config.d/femtofox/femtofox_Waveshare-SX126X-XXXM_AI-Thinker-RA-01SH.yaml
* moved femtofox configs to subdir
* [Add] LR1110, LR1120 and LR1121 to linux native Portduino (#5496)
* Update main.cpp
* Update PortduinoGlue.h
* Update PortduinoGlue.cpp
* Update PortduinoGlue.cpp
* Update PortduinoGlue.cpp
* Update main.cpp
* [create-pull-request] automated change (#5500)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Fix minor typos in package workflows (#5505)
* Don't use channel index for encrypted packet (#5509)
* Don't use channel index for encrypted packet
* Remove assert in `getKey`, set invalid key length
So encrypting will fail without reboot
* Reset channel to 0 when unable to encrypt
Such that the NAK doesn't use the failing channel hash
* Always Announce MDNS meshtastic service (#5503)
* refactor server api port into define
* always announce MDNS meshtastic service
* fix nodeDB erase loop when free mem returns invalid value (0, -1). (#5519)
Co-authored-by: mverch67 <manuel.verch@gmx.de>
* Add heltec capsule back
* Revert "Add heltec capsule back"
This reverts commit fc16d9342116235fa86cf6ac163b17125bb4b50e.
* Lets try this again minus device ui
* Add popular nrf52 pro micro to the builds (#5523)
* Add MACAddress to config.yaml (#5506)
* Add MACAddress to config.yaml
* Better error handling on native, including failing to launch with blank MAC Address and real hardware.
* Re-arrange Mac Address handling and add MACAddressSource
* Bump portduino to remove macaddr function there
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Configure Seeed Xiao S3 RX enable pin (#5517)
* Create OpenWRT_One_mikroBUS_sx1262.yaml (#5529)
* tlora_v2_1_16: Unset BUTTON_PIN and BUTTON_NEED_PULLUP (#5535)
Unset BUTTON_PIN and BUTTON_NEED_PULLUP as the board ships without a user button.
Devices and users expecting a button on GPIO12 have to set [GPIO for user button](https://meshtastic.org/docs/configuration/radio/device/#gpio-for-user-button) to 12 (or any GPIO pin the momentary switch was connected to) to restore functionality.
Signed-off-by: Andrew Yong <me@ndoo.sg>
* [create-pull-request] automated change (#5530)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Fix detection for some RadSens hardware versions (#5542)
Co-authored-by: Jake-B <jake-b@users.noreply.github.com>
* Initialize dmac array to nulls (#5538)
* Initialize dmac array to nulls
* Use std::cout for print before console is init.
* Update OpenWRT_One_mikroBUS_sx1262.yaml (#5544)
* Add portduino-buildroot variant (#5540)
* Add portduino-buildroot variant
* Update platform-native for platform-buildroot
* portduino-buildroot: Define c standard (#5547)
* Portduino: Move meshtasticd/web out of /usr/share/doc/ (#5548)
* Portduino: fix transitional symlinks (#5550)
* Windows Support - Trunk and Platformio (#5397) (#5518)
* Add support for GPG
* Add usb device support
* Add trunk.io to devcontainer
* Trunk things
* trunk fmt
* formatting
* fix trivy/DS002, checkov/CKV_DOCKER_3
* hide docker extension popup
* fix trivy/DS026, checkov/CKV_DOCKER_2
Co-authored-by: Kalle Lilja <15094562+ThatKalle@users.noreply.github.com>
* Synch minor changes from TFT branch (#5520)
* Synch minor changes from TFT branch
Includes:
* New nordicnrf52 minor version (10.5.0 --> 10.6.0)
* Optimisations for T_DECK
* preparation for MESH_TAB
* add ext notification module to portduino
---------
Co-authored-by: mverch67 <manuel.verch@gmx.de>
* DIO3_TCXO_VOLTAGE in config.yaml can now take an exact voltage (#5558)
* Support TLORA_V3.0 (#5563)
- Support TLORA_V3.0. Update of the legendary 2.1_1.6.1 with solar charger, TCXO and IPEX connector.
- 'extra' some short-lived EOL intermediate boards in that range. If possible use T3S3 instead of all of these!
- update trunk to latest version
* Create OpenWRT-One-mikroBUS-LR-IOT-CLICK.yaml (#5564)
* Portduino: fix setting hwId via argument (#5565)
* INA219 charging detection
minimal implementation: if there is a configured INA219 sensor for battery monitoring we can take the current flow across the shunt resistor to know if we are charging the battery - negative milliamps indicate charging
* Update Power.cpp
added comments and 2 extra defines to disable and swap detection direction
* Trunk Fixes
* Add INA226 support
---------
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
Signed-off-by: Andrew Yong <me@ndoo.sg>
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz>
Co-authored-by: GUVWAF <78759985+GUVWAF@users.noreply.github.com>
Co-authored-by: Tom Fifield <tom@tomfifield.net>
Co-authored-by: Michael Gjelsø <36234524+gjelsoe@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
Co-authored-by: jcyrio <50239349+jcyrio@users.noreply.github.com>
Co-authored-by: Daniel.Cao <144674500+DanielCao0@users.noreply.github.com>
Co-authored-by: Catalin Patulea <cronos586@gmail.com>
Co-authored-by: dylanli <dylan3000dylan@gmail.com>
Co-authored-by: mverch67 <manuel.verch@gmx.de>
Co-authored-by: madeofstown <33820964+madeofstown@users.noreply.github.com>
Co-authored-by: Christopher Hoover <ch@murgatroid.com>
Co-authored-by: Mictronics <github@mictronics.de>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
Co-authored-by: caveman99 <25002+caveman99@users.noreply.github.com>
Co-authored-by: jake-b <1012393+jake-b@users.noreply.github.com>
Co-authored-by: César de Tassis Filho <CTassisF@users.noreply.github.com>
Co-authored-by: Tomas Dubec <tomas.dubec@gmail.com>
Co-authored-by: Liam Cottle <liam@liamcottle.com>
Co-authored-by: panaceya <panaceya@users.noreply.github.com>
Co-authored-by: virgil <virgil.wang.cj@gmail.com>
Co-authored-by: Robert <r@rbrt.io>
Co-authored-by: noon92 <40807970+noon92@users.noreply.github.com>
Co-authored-by: Mark Trevor Birss <markbirss@gmail.com>
Co-authored-by: broglep <20624281+broglep@users.noreply.github.com>
Co-authored-by: Matthias Granberry <matthias.granberry@gmail.com>
Co-authored-by: Andrew Yong <me@ndoo.sg>
Co-authored-by: Jake-B <jake-b@users.noreply.github.com>
Co-authored-by: Austin <vidplace7@gmail.com>
Co-authored-by: Kalle Lilja <15094562+ThatKalle@users.noreply.github.com>
2024-12-22 05:02:50 +01:00
|
|
|
|
#endif
|
2024-03-12 17:55:31 +01:00
|
|
|
|
#endif
|
2025-04-17 16:03:37 +02:00
|
|
|
|
// by default, we check the battery voltage only
|
|
|
|
|
|
return isVbusIn();
|
2024-03-12 17:55:31 +01:00
|
|
|
|
}
|
2020-10-18 09:44:29 +08:00
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
/// If we see a battery voltage higher than physics allows - assume charger is pumping
|
|
|
|
|
|
/// in power
|
2021-05-09 10:31:42 +08:00
|
|
|
|
|
2024-02-16 13:09:57 +01:00
|
|
|
|
/// For heltecs with no battery connected, the measured voltage is 2204, so
|
|
|
|
|
|
// need to be higher than that, in this case is 2500mV (3000-500)
|
|
|
|
|
|
const uint16_t OCV[NUM_OCV_POINTS] = {OCV_ARRAY};
|
|
|
|
|
|
const float chargingVolt = (OCV[0] + 10) * NUM_CELLS;
|
|
|
|
|
|
const float noBatVolt = (OCV[NUM_OCV_POINTS - 1] - 500) * NUM_CELLS;
|
|
|
|
|
|
// Start value from minimum voltage for the filter to not start from 0
|
|
|
|
|
|
// that could trigger some events.
|
2024-05-03 00:14:44 +12:00
|
|
|
|
// This value is over-written by the first ADC reading, it the voltage seems reasonable.
|
|
|
|
|
|
bool initial_read_done = false;
|
2024-02-16 13:09:57 +01:00
|
|
|
|
float last_read_value = (OCV[NUM_OCV_POINTS - 1] * NUM_CELLS);
|
2021-03-14 19:00:20 -07:00
|
|
|
|
uint32_t last_read_time_ms = 0;
|
2023-06-02 06:32:34 -05:00
|
|
|
|
|
2025-01-20 09:34:54 +01:00
|
|
|
|
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && defined(HAS_RAKPROT)
|
2024-06-16 14:24:36 +08:00
|
|
|
|
|
|
|
|
|
|
uint16_t getRAKVoltage() { return rak9154Sensor.getBusVoltageMv(); }
|
|
|
|
|
|
|
|
|
|
|
|
bool hasRAK()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!rak9154Sensor.isInitialized())
|
|
|
|
|
|
return rak9154Sensor.runOnce() > 0;
|
|
|
|
|
|
return rak9154Sensor.isRunning();
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2025-07-02 12:01:45 +01:00
|
|
|
|
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
2023-06-02 06:32:34 -05:00
|
|
|
|
uint16_t getINAVoltage()
|
|
|
|
|
|
{
|
2023-10-15 02:33:45 +02:00
|
|
|
|
if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA219].first == config.power.device_battery_ina_address) {
|
2023-06-02 06:32:34 -05:00
|
|
|
|
return ina219Sensor.getBusVoltageMv();
|
Detect charging status by measuring current flow with configured INA battery sensor (#5271)
* INA219 charging detection
minimal implementation: if there is a configured INA219 sensor for battery monitoring we can take the current flow across the shunt resistor to know if we are charging the battery - negative milliamps indicate charging
* Update Power.cpp
added comments and 2 extra defines to disable and swap detection direction
* Update Power.cpp
fix disabled case
* move getCurrentMa() to new CurrentSensor class
* INA219 charging detection
minimal implementation: if there is a configured INA219 sensor for battery monitoring we can take the current flow across the shunt resistor to know if we are charging the battery - negative milliamps indicate charging
* Update Power.cpp
added comments and 2 extra defines to disable and swap detection direction
* Update Power.cpp
fix disabled case
* move getCurrentMa() to new CurrentSensor class
* add INA3221 charging detection
* RP2040: Update core; add mDNS support (#5355)
* Update arduino-pico core
* RP2040: Add mDNS support
* SimpleMDNS `begin` now returns a bool
* Add `-g` option to `debug_build_flags` to link files for gdb
* RAK11310 needs old platform as well
* Change defines to specific architecture
* Core version 4.2.1 is out
* Add sudo to apt-get commands for Raspbian Build (#5364)
Without sudo, inadequate permissions to runs the commands meant
the build was failing.
* Typo fix in build_raspbian.yml (#5365)
s/sudp/sudo :(:(:(
* Rework some things
* Trunk
* Separate littlefs bundle
* version tags
* Diag
* Add littlefswebui
* Bug fixed in ExternalNotificationModule (#5375)
While `nagging` setExternalState wasn't written to Buzzer & Vibra so output was never toggled.
Possible fix for #5348
* Cleanup static files from bad Web UI bundle on 2.5.13 release (#5376)
* Cleanup static files from bad Web UI bundle on 2.5.13 release
* Check existence first
* Esp32 is the only one we care about
* Move some actions to after `startTransmit()` (#5383)
To minimize the time between channel scan and actual transmit
* [create-pull-request] automated change (#5380)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Allows all 3 PKI keys to be added to userPrefs.h (#4969) and a tool. (#5368)
* more userPrefs.h
Added PKI Admin keys to userPrefs.h
* Update userPrefs.h
Allows all 3 PKI keys to be added to userPrefs.h (#4969)
* Update NodeDB.cpp
Trunk
* Update userPrefs.h
Changed wording
* Create base64_to_hex.py
A little tool for converting base64 PKI Keys to decoded byte that userPrefs.h can understand.
* more userPrefs.h
Added PKI Admin keys to userPrefs.h
* Update userPrefs.h
Allows all 3 PKI keys to be added to userPrefs.h (#4969)
* Update NodeDB.cpp
Trunk
* Update userPrefs.h
Changed wording
* Create base64_to_hex.py
A little tool for converting base64 PKI Keys to decoded byte that userPrefs.h can understand.
* [create-pull-request] automated change (#5388)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* add smiley emoji (#5391)
* add smiley emoji
* clang-formatted
* Anable trace route function on wismeshtap platform (#5389)
* fix 'symbal' typo (#5395)
* [create-pull-request] automated change (#5399)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* /api/v1/fromradio: add OPTIONS handler for CORS. (#5386)
This avoids hitting the 404 Not Found handler, which breaks connection
keep-alive, so this change fixes a big performance regression for Web Client in
Chrome: https://github.com/meshtastic/firmware/issues/5385
Tested on Heltec V3.
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Make heart emoji usable (#5403)
* Create a specific hw_model for WisMesh Tap (#5400)
* Create a specific hw_model for WisMesh Tap
* Trunk
* HAS_ETHERNET
* Remove it altogether
* Don't need these either
* Fix RTC time injection and consolidate position logic (#5396)
* Fix RTC time injection and consolidate position logic
* Comment out unused var warning
* Backerds
* Update arduino-pico core to fix sporadic hangs (#5406)
* Update platform-raspberrypi also (#5407)
* Update arduino-pico core to fix sporadic hangs
* Update platform-raspberrypi also
* --web added to device-install(.sh/.bat) (#5405)
* Add --web
* Update device-install.bat
Forgot a "-" a few places.
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* add GPS in indicator board (#5411)
* Fixed NMEA sentence issue in CalTopo as well as bug with no printing all of the nodes (#5412)
* --web littlefswebui-* typo fix (#5416)
* Add --web
* Update device-install.bat
Forgot a "-" a few places.
* Typo fix.
* Typo fix
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: GUVWAF <78759985+GUVWAF@users.noreply.github.com>
* Temporarily disable MDNS when MQTT is enabled (#5418)
Leads to a panic
* Check for OkToMqtt flag presence before uplinking to MQTT (#5413)
* Check for oktomqtt flag presence before uplinking to MQTT
* Move to mqtt->onSend
* Temetry can respond to want-response for LocalStats variant (#5414)
* Seems like the last DIY board that's not "extra" (#5420)
* Cherry pick tdeck fixes (#5422)
* Try-fix (workaround) T-Deck audio crash
* set T-Deck audio to unused 48 (mem mclk)
* swap mclk to gpio 21
* dreamcatcher: assign GPIO44 to audio mclk
---------
Co-authored-by: mverch67 <manuel.verch@gmx.de>
* add canned message and keyboard in indicator board (#5410)
* add canned message and keyboard in indicator board
* Added virtual keyboard macro and enabled for Indicator
* Cleanup macros by applying USE_VIRTUAL_KEYBOARD and DISPLAY_CLOCK_FRAME
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Update build-native.sh (#5415)
* Update build-native.sh
Device-install.sh and device-update.sh are not used on native platform, skip copying to release directory after build and copy native-install.sh and native-run.sh instead.
* Update build-native.sh
Skip native-run.sh copy
* Cleans up visibility in GPS.h (#5426)
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
* Fix admin key loading from userPrefs.h (#5417)
* 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
* Fix warning: extra tokens at end of #endif directive.
* Fix antenna switching logic. Complementary-pin control logic is required on the rp2040-lora board.
* Fix deprecated macros.
* Set RP2040 in dormant mode when deep sleep is triggered.
* Fix array out of bounds read.
* Admin key count needs to be set otherwise the key will be zero loaded after reset.
* Don't reset the admin key size when loading defaults. Preserve an existing key in config if possible.
* Remove log spam when reading INA voltage sensor.
* Remove static declaration for admin keys from userPrefs.h. Load hard coded admin keys in case config file has empty slots.
* Removed newlines from log.
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
* try to detect dfrobot station to tell it apart from an ublox gps. (#5393)
* Remove BMA-423 and STK8X by default (#5429)
* Remove BMA-423 by default
* STK
* Wrong macro
* Helps if you include the file
* [create-pull-request] automated change (#5431)
Co-authored-by: caveman99 <25002+caveman99@users.noreply.github.com>
* Support for the ClimateGuard RadSens Geiger-Muller tube (#5425)
* fixes https://github.com/meshtastic/firmware/issues/5434 (#5435)
* update libpax
* fix interval init
* Fix memory leaks by adding missing `free()` calls before early returns in `MQTT::onReceive` (#5439)
This fix addresses memory leaks in the `MQTT::onReceive` function by ensuring that dynamically allocated resources (`e.channel_id`, `e.gateway_id` and `e.packet`) are properly freed before each early return. Previously, these resources were only freed at the end of the function, leaving them unhandled in certain exit paths. Adding the missing `free()` calls prevents memory leaks and ensures proper resource cleanup in all scenarios.
* Removing 1.0 legacy boards from releases and completely removing Heltec wireless capsule from support (#5436)
Co-authored-by: Tom Fifield <tom@tomfifield.net>
* A second round of cleanup on GPS.h. (#5433)
* Move yet more stuff out of GPS.h and into file scope.
* Protect code macros from eating semicolons.
* Remove unused (and unimplemented) getDOPString.
* clang-format with project style file on affected files.
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
* enable MQTT with TLS on RPi picow (#5442)
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Don't powersave on Wifi (#5443)
* Don't go into light sleep with wifi enabled
* Move
* Trunk
* Revert "Seems like the last DIY board that's not "extra" (#5420)" (#5446)
This reverts commit e6fb6b115aebb12b31fb93ed9d1508a6109b2f03.
* Actually gunzip all the files when building a .deb (#5449)
* [create-pull-request] automated change (#5457)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Cleanup i2c scan logs and macro to save some bytes and remain consistent (#5455)
* Cleanup i2c scan logs and macro to save some bytes and remain consistent
* Functions are better than macros
* Exclude i2c scan for STM32
* Useless log
* Clean up some inline functions (#5454)
* Use isWithinTimespanMs to avoid refererence to NodeDb instance inside of NodeDb (#5453)
* fix cors for meshtasticd to allow use of cross origin clients (#5463)
* Remove ATECC crypto chip placeholder code (#5461)
* GPS.h cleanups round 3. (#5447)
* GPS.h cleanups round 3.
No effective behavior change.
Protected members can be private so make it so. (Supporting
subclasses needs a lot more work.)
Moves uBloxGnssModelInfo into file scope.
Moves uBloxProtocolVersion into uBloxGnssModelInfo.
Moves baud rate arrays into file scope.
Removes unused/ unimplemented powerStateToString.
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
* Trunk Format.
---------
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
Co-authored-by: Tom Fifield <tom@tomfifield.net>
* Fix ukrainian fonts (#5468)
* FIX: rollback to !4624
* UPDATE: new 16 and 24 UA Fonts and fixes
* fix: Solve the lightsleep crash problem via disable lightsleep for indicator. (#5470)
* Trunk
* Warnings and log cleanup (#5472)
* Don't log if keyboard not found
* Signed comparison issue
* [create-pull-request] automated change (#5475)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Adds libusb dev package to Raspbian build steps (#5480)
* [create-pull-request] automated change (#5478)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Portduino fixes (#5479)
* Set config.yaml defaults even if General is missing
* Unsigned values should get %u in logging
* Update arduino-pico core and remove MDNS restriction (#5483)
* Update xiao_esp32 fully support L67K (#5488)
L67K module hardware changed
* Convert userprefs to a json file instead of header file which has to be included everywhere (#5471)
* WIP
* Got string quoting and macro expansion working
* Need the placeholder
* Cleanup
* Missed a user prefs reference
* Update jsonc
* SimRadio: clean-up and emulate collisions (#5487)
* Clean up SimRadio and don't let it use PKC
* Add collision emulation for SimRadio
* Add stats from SimRadio to LocalStats
* Make emulating collisions optional
* add nodeId to nodeinfo update log lines and removed redundant nodeinfo update log line (#5493)
* Refact the macro definition of GPS initialization of GPSDEFAULTD_NOT_PRESENT and added seeeed Indicator to this sequence (#5494)
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Extend Length of Source and Destination Node IDs Logged (#5492)
* show 8 chars for logging source and destination ids
* extend legnth of source and destination nodes in log
* Added femtofox configs (#5477)
* added femtofox configs
* Rename bin/config.d/femtofox_Waveshare-SX126X-XXXM_AI-Thinker-RA-01SH.yaml to bin/config.d/femtofox/femtofox_Waveshare-SX126X-XXXM_AI-Thinker-RA-01SH.yaml
* moved femtofox configs to subdir
* [Add] LR1110, LR1120 and LR1121 to linux native Portduino (#5496)
* Update main.cpp
* Update PortduinoGlue.h
* Update PortduinoGlue.cpp
* Update PortduinoGlue.cpp
* Update PortduinoGlue.cpp
* Update main.cpp
* [create-pull-request] automated change (#5500)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Fix minor typos in package workflows (#5505)
* Don't use channel index for encrypted packet (#5509)
* Don't use channel index for encrypted packet
* Remove assert in `getKey`, set invalid key length
So encrypting will fail without reboot
* Reset channel to 0 when unable to encrypt
Such that the NAK doesn't use the failing channel hash
* Always Announce MDNS meshtastic service (#5503)
* refactor server api port into define
* always announce MDNS meshtastic service
* fix nodeDB erase loop when free mem returns invalid value (0, -1). (#5519)
Co-authored-by: mverch67 <manuel.verch@gmx.de>
* Add heltec capsule back
* Revert "Add heltec capsule back"
This reverts commit fc16d9342116235fa86cf6ac163b17125bb4b50e.
* Lets try this again minus device ui
* Add popular nrf52 pro micro to the builds (#5523)
* Add MACAddress to config.yaml (#5506)
* Add MACAddress to config.yaml
* Better error handling on native, including failing to launch with blank MAC Address and real hardware.
* Re-arrange Mac Address handling and add MACAddressSource
* Bump portduino to remove macaddr function there
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Configure Seeed Xiao S3 RX enable pin (#5517)
* Create OpenWRT_One_mikroBUS_sx1262.yaml (#5529)
* tlora_v2_1_16: Unset BUTTON_PIN and BUTTON_NEED_PULLUP (#5535)
Unset BUTTON_PIN and BUTTON_NEED_PULLUP as the board ships without a user button.
Devices and users expecting a button on GPIO12 have to set [GPIO for user button](https://meshtastic.org/docs/configuration/radio/device/#gpio-for-user-button) to 12 (or any GPIO pin the momentary switch was connected to) to restore functionality.
Signed-off-by: Andrew Yong <me@ndoo.sg>
* [create-pull-request] automated change (#5530)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Fix detection for some RadSens hardware versions (#5542)
Co-authored-by: Jake-B <jake-b@users.noreply.github.com>
* Initialize dmac array to nulls (#5538)
* Initialize dmac array to nulls
* Use std::cout for print before console is init.
* Update OpenWRT_One_mikroBUS_sx1262.yaml (#5544)
* Add portduino-buildroot variant (#5540)
* Add portduino-buildroot variant
* Update platform-native for platform-buildroot
* portduino-buildroot: Define c standard (#5547)
* Portduino: Move meshtasticd/web out of /usr/share/doc/ (#5548)
* Portduino: fix transitional symlinks (#5550)
* Windows Support - Trunk and Platformio (#5397) (#5518)
* Add support for GPG
* Add usb device support
* Add trunk.io to devcontainer
* Trunk things
* trunk fmt
* formatting
* fix trivy/DS002, checkov/CKV_DOCKER_3
* hide docker extension popup
* fix trivy/DS026, checkov/CKV_DOCKER_2
Co-authored-by: Kalle Lilja <15094562+ThatKalle@users.noreply.github.com>
* Synch minor changes from TFT branch (#5520)
* Synch minor changes from TFT branch
Includes:
* New nordicnrf52 minor version (10.5.0 --> 10.6.0)
* Optimisations for T_DECK
* preparation for MESH_TAB
* add ext notification module to portduino
---------
Co-authored-by: mverch67 <manuel.verch@gmx.de>
* DIO3_TCXO_VOLTAGE in config.yaml can now take an exact voltage (#5558)
* Support TLORA_V3.0 (#5563)
- Support TLORA_V3.0. Update of the legendary 2.1_1.6.1 with solar charger, TCXO and IPEX connector.
- 'extra' some short-lived EOL intermediate boards in that range. If possible use T3S3 instead of all of these!
- update trunk to latest version
* Create OpenWRT-One-mikroBUS-LR-IOT-CLICK.yaml (#5564)
* Portduino: fix setting hwId via argument (#5565)
* INA219 charging detection
minimal implementation: if there is a configured INA219 sensor for battery monitoring we can take the current flow across the shunt resistor to know if we are charging the battery - negative milliamps indicate charging
* Update Power.cpp
added comments and 2 extra defines to disable and swap detection direction
* Trunk Fixes
* Add INA226 support
---------
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
Signed-off-by: Andrew Yong <me@ndoo.sg>
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz>
Co-authored-by: GUVWAF <78759985+GUVWAF@users.noreply.github.com>
Co-authored-by: Tom Fifield <tom@tomfifield.net>
Co-authored-by: Michael Gjelsø <36234524+gjelsoe@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
Co-authored-by: jcyrio <50239349+jcyrio@users.noreply.github.com>
Co-authored-by: Daniel.Cao <144674500+DanielCao0@users.noreply.github.com>
Co-authored-by: Catalin Patulea <cronos586@gmail.com>
Co-authored-by: dylanli <dylan3000dylan@gmail.com>
Co-authored-by: mverch67 <manuel.verch@gmx.de>
Co-authored-by: madeofstown <33820964+madeofstown@users.noreply.github.com>
Co-authored-by: Christopher Hoover <ch@murgatroid.com>
Co-authored-by: Mictronics <github@mictronics.de>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
Co-authored-by: caveman99 <25002+caveman99@users.noreply.github.com>
Co-authored-by: jake-b <1012393+jake-b@users.noreply.github.com>
Co-authored-by: César de Tassis Filho <CTassisF@users.noreply.github.com>
Co-authored-by: Tomas Dubec <tomas.dubec@gmail.com>
Co-authored-by: Liam Cottle <liam@liamcottle.com>
Co-authored-by: panaceya <panaceya@users.noreply.github.com>
Co-authored-by: virgil <virgil.wang.cj@gmail.com>
Co-authored-by: Robert <r@rbrt.io>
Co-authored-by: noon92 <40807970+noon92@users.noreply.github.com>
Co-authored-by: Mark Trevor Birss <markbirss@gmail.com>
Co-authored-by: broglep <20624281+broglep@users.noreply.github.com>
Co-authored-by: Matthias Granberry <matthias.granberry@gmail.com>
Co-authored-by: Andrew Yong <me@ndoo.sg>
Co-authored-by: Jake-B <jake-b@users.noreply.github.com>
Co-authored-by: Austin <vidplace7@gmail.com>
Co-authored-by: Kalle Lilja <15094562+ThatKalle@users.noreply.github.com>
2024-12-22 05:02:50 +01:00
|
|
|
|
} else if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA226].first ==
|
|
|
|
|
|
config.power.device_battery_ina_address) {
|
|
|
|
|
|
return ina226Sensor.getBusVoltageMv();
|
2023-10-15 02:33:45 +02:00
|
|
|
|
} else if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA260].first ==
|
|
|
|
|
|
config.power.device_battery_ina_address) {
|
2023-06-02 06:32:34 -05:00
|
|
|
|
return ina260Sensor.getBusVoltageMv();
|
2023-11-17 05:46:59 -07:00
|
|
|
|
} else if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA3221].first ==
|
|
|
|
|
|
config.power.device_battery_ina_address) {
|
|
|
|
|
|
return ina3221Sensor.getBusVoltageMv();
|
2023-06-02 06:32:34 -05:00
|
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
Detect charging status by measuring current flow with configured INA battery sensor (#5271)
* INA219 charging detection
minimal implementation: if there is a configured INA219 sensor for battery monitoring we can take the current flow across the shunt resistor to know if we are charging the battery - negative milliamps indicate charging
* Update Power.cpp
added comments and 2 extra defines to disable and swap detection direction
* Update Power.cpp
fix disabled case
* move getCurrentMa() to new CurrentSensor class
* INA219 charging detection
minimal implementation: if there is a configured INA219 sensor for battery monitoring we can take the current flow across the shunt resistor to know if we are charging the battery - negative milliamps indicate charging
* Update Power.cpp
added comments and 2 extra defines to disable and swap detection direction
* Update Power.cpp
fix disabled case
* move getCurrentMa() to new CurrentSensor class
* add INA3221 charging detection
* RP2040: Update core; add mDNS support (#5355)
* Update arduino-pico core
* RP2040: Add mDNS support
* SimpleMDNS `begin` now returns a bool
* Add `-g` option to `debug_build_flags` to link files for gdb
* RAK11310 needs old platform as well
* Change defines to specific architecture
* Core version 4.2.1 is out
* Add sudo to apt-get commands for Raspbian Build (#5364)
Without sudo, inadequate permissions to runs the commands meant
the build was failing.
* Typo fix in build_raspbian.yml (#5365)
s/sudp/sudo :(:(:(
* Rework some things
* Trunk
* Separate littlefs bundle
* version tags
* Diag
* Add littlefswebui
* Bug fixed in ExternalNotificationModule (#5375)
While `nagging` setExternalState wasn't written to Buzzer & Vibra so output was never toggled.
Possible fix for #5348
* Cleanup static files from bad Web UI bundle on 2.5.13 release (#5376)
* Cleanup static files from bad Web UI bundle on 2.5.13 release
* Check existence first
* Esp32 is the only one we care about
* Move some actions to after `startTransmit()` (#5383)
To minimize the time between channel scan and actual transmit
* [create-pull-request] automated change (#5380)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Allows all 3 PKI keys to be added to userPrefs.h (#4969) and a tool. (#5368)
* more userPrefs.h
Added PKI Admin keys to userPrefs.h
* Update userPrefs.h
Allows all 3 PKI keys to be added to userPrefs.h (#4969)
* Update NodeDB.cpp
Trunk
* Update userPrefs.h
Changed wording
* Create base64_to_hex.py
A little tool for converting base64 PKI Keys to decoded byte that userPrefs.h can understand.
* more userPrefs.h
Added PKI Admin keys to userPrefs.h
* Update userPrefs.h
Allows all 3 PKI keys to be added to userPrefs.h (#4969)
* Update NodeDB.cpp
Trunk
* Update userPrefs.h
Changed wording
* Create base64_to_hex.py
A little tool for converting base64 PKI Keys to decoded byte that userPrefs.h can understand.
* [create-pull-request] automated change (#5388)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* add smiley emoji (#5391)
* add smiley emoji
* clang-formatted
* Anable trace route function on wismeshtap platform (#5389)
* fix 'symbal' typo (#5395)
* [create-pull-request] automated change (#5399)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* /api/v1/fromradio: add OPTIONS handler for CORS. (#5386)
This avoids hitting the 404 Not Found handler, which breaks connection
keep-alive, so this change fixes a big performance regression for Web Client in
Chrome: https://github.com/meshtastic/firmware/issues/5385
Tested on Heltec V3.
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Make heart emoji usable (#5403)
* Create a specific hw_model for WisMesh Tap (#5400)
* Create a specific hw_model for WisMesh Tap
* Trunk
* HAS_ETHERNET
* Remove it altogether
* Don't need these either
* Fix RTC time injection and consolidate position logic (#5396)
* Fix RTC time injection and consolidate position logic
* Comment out unused var warning
* Backerds
* Update arduino-pico core to fix sporadic hangs (#5406)
* Update platform-raspberrypi also (#5407)
* Update arduino-pico core to fix sporadic hangs
* Update platform-raspberrypi also
* --web added to device-install(.sh/.bat) (#5405)
* Add --web
* Update device-install.bat
Forgot a "-" a few places.
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* add GPS in indicator board (#5411)
* Fixed NMEA sentence issue in CalTopo as well as bug with no printing all of the nodes (#5412)
* --web littlefswebui-* typo fix (#5416)
* Add --web
* Update device-install.bat
Forgot a "-" a few places.
* Typo fix.
* Typo fix
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: GUVWAF <78759985+GUVWAF@users.noreply.github.com>
* Temporarily disable MDNS when MQTT is enabled (#5418)
Leads to a panic
* Check for OkToMqtt flag presence before uplinking to MQTT (#5413)
* Check for oktomqtt flag presence before uplinking to MQTT
* Move to mqtt->onSend
* Temetry can respond to want-response for LocalStats variant (#5414)
* Seems like the last DIY board that's not "extra" (#5420)
* Cherry pick tdeck fixes (#5422)
* Try-fix (workaround) T-Deck audio crash
* set T-Deck audio to unused 48 (mem mclk)
* swap mclk to gpio 21
* dreamcatcher: assign GPIO44 to audio mclk
---------
Co-authored-by: mverch67 <manuel.verch@gmx.de>
* add canned message and keyboard in indicator board (#5410)
* add canned message and keyboard in indicator board
* Added virtual keyboard macro and enabled for Indicator
* Cleanup macros by applying USE_VIRTUAL_KEYBOARD and DISPLAY_CLOCK_FRAME
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Update build-native.sh (#5415)
* Update build-native.sh
Device-install.sh and device-update.sh are not used on native platform, skip copying to release directory after build and copy native-install.sh and native-run.sh instead.
* Update build-native.sh
Skip native-run.sh copy
* Cleans up visibility in GPS.h (#5426)
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
* Fix admin key loading from userPrefs.h (#5417)
* 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
* Fix warning: extra tokens at end of #endif directive.
* Fix antenna switching logic. Complementary-pin control logic is required on the rp2040-lora board.
* Fix deprecated macros.
* Set RP2040 in dormant mode when deep sleep is triggered.
* Fix array out of bounds read.
* Admin key count needs to be set otherwise the key will be zero loaded after reset.
* Don't reset the admin key size when loading defaults. Preserve an existing key in config if possible.
* Remove log spam when reading INA voltage sensor.
* Remove static declaration for admin keys from userPrefs.h. Load hard coded admin keys in case config file has empty slots.
* Removed newlines from log.
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
* try to detect dfrobot station to tell it apart from an ublox gps. (#5393)
* Remove BMA-423 and STK8X by default (#5429)
* Remove BMA-423 by default
* STK
* Wrong macro
* Helps if you include the file
* [create-pull-request] automated change (#5431)
Co-authored-by: caveman99 <25002+caveman99@users.noreply.github.com>
* Support for the ClimateGuard RadSens Geiger-Muller tube (#5425)
* fixes https://github.com/meshtastic/firmware/issues/5434 (#5435)
* update libpax
* fix interval init
* Fix memory leaks by adding missing `free()` calls before early returns in `MQTT::onReceive` (#5439)
This fix addresses memory leaks in the `MQTT::onReceive` function by ensuring that dynamically allocated resources (`e.channel_id`, `e.gateway_id` and `e.packet`) are properly freed before each early return. Previously, these resources were only freed at the end of the function, leaving them unhandled in certain exit paths. Adding the missing `free()` calls prevents memory leaks and ensures proper resource cleanup in all scenarios.
* Removing 1.0 legacy boards from releases and completely removing Heltec wireless capsule from support (#5436)
Co-authored-by: Tom Fifield <tom@tomfifield.net>
* A second round of cleanup on GPS.h. (#5433)
* Move yet more stuff out of GPS.h and into file scope.
* Protect code macros from eating semicolons.
* Remove unused (and unimplemented) getDOPString.
* clang-format with project style file on affected files.
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
* enable MQTT with TLS on RPi picow (#5442)
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Don't powersave on Wifi (#5443)
* Don't go into light sleep with wifi enabled
* Move
* Trunk
* Revert "Seems like the last DIY board that's not "extra" (#5420)" (#5446)
This reverts commit e6fb6b115aebb12b31fb93ed9d1508a6109b2f03.
* Actually gunzip all the files when building a .deb (#5449)
* [create-pull-request] automated change (#5457)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Cleanup i2c scan logs and macro to save some bytes and remain consistent (#5455)
* Cleanup i2c scan logs and macro to save some bytes and remain consistent
* Functions are better than macros
* Exclude i2c scan for STM32
* Useless log
* Clean up some inline functions (#5454)
* Use isWithinTimespanMs to avoid refererence to NodeDb instance inside of NodeDb (#5453)
* fix cors for meshtasticd to allow use of cross origin clients (#5463)
* Remove ATECC crypto chip placeholder code (#5461)
* GPS.h cleanups round 3. (#5447)
* GPS.h cleanups round 3.
No effective behavior change.
Protected members can be private so make it so. (Supporting
subclasses needs a lot more work.)
Moves uBloxGnssModelInfo into file scope.
Moves uBloxProtocolVersion into uBloxGnssModelInfo.
Moves baud rate arrays into file scope.
Removes unused/ unimplemented powerStateToString.
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
* Trunk Format.
---------
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
Co-authored-by: Tom Fifield <tom@tomfifield.net>
* Fix ukrainian fonts (#5468)
* FIX: rollback to !4624
* UPDATE: new 16 and 24 UA Fonts and fixes
* fix: Solve the lightsleep crash problem via disable lightsleep for indicator. (#5470)
* Trunk
* Warnings and log cleanup (#5472)
* Don't log if keyboard not found
* Signed comparison issue
* [create-pull-request] automated change (#5475)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Adds libusb dev package to Raspbian build steps (#5480)
* [create-pull-request] automated change (#5478)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Portduino fixes (#5479)
* Set config.yaml defaults even if General is missing
* Unsigned values should get %u in logging
* Update arduino-pico core and remove MDNS restriction (#5483)
* Update xiao_esp32 fully support L67K (#5488)
L67K module hardware changed
* Convert userprefs to a json file instead of header file which has to be included everywhere (#5471)
* WIP
* Got string quoting and macro expansion working
* Need the placeholder
* Cleanup
* Missed a user prefs reference
* Update jsonc
* SimRadio: clean-up and emulate collisions (#5487)
* Clean up SimRadio and don't let it use PKC
* Add collision emulation for SimRadio
* Add stats from SimRadio to LocalStats
* Make emulating collisions optional
* add nodeId to nodeinfo update log lines and removed redundant nodeinfo update log line (#5493)
* Refact the macro definition of GPS initialization of GPSDEFAULTD_NOT_PRESENT and added seeeed Indicator to this sequence (#5494)
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Extend Length of Source and Destination Node IDs Logged (#5492)
* show 8 chars for logging source and destination ids
* extend legnth of source and destination nodes in log
* Added femtofox configs (#5477)
* added femtofox configs
* Rename bin/config.d/femtofox_Waveshare-SX126X-XXXM_AI-Thinker-RA-01SH.yaml to bin/config.d/femtofox/femtofox_Waveshare-SX126X-XXXM_AI-Thinker-RA-01SH.yaml
* moved femtofox configs to subdir
* [Add] LR1110, LR1120 and LR1121 to linux native Portduino (#5496)
* Update main.cpp
* Update PortduinoGlue.h
* Update PortduinoGlue.cpp
* Update PortduinoGlue.cpp
* Update PortduinoGlue.cpp
* Update main.cpp
* [create-pull-request] automated change (#5500)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Fix minor typos in package workflows (#5505)
* Don't use channel index for encrypted packet (#5509)
* Don't use channel index for encrypted packet
* Remove assert in `getKey`, set invalid key length
So encrypting will fail without reboot
* Reset channel to 0 when unable to encrypt
Such that the NAK doesn't use the failing channel hash
* Always Announce MDNS meshtastic service (#5503)
* refactor server api port into define
* always announce MDNS meshtastic service
* fix nodeDB erase loop when free mem returns invalid value (0, -1). (#5519)
Co-authored-by: mverch67 <manuel.verch@gmx.de>
* Add heltec capsule back
* Revert "Add heltec capsule back"
This reverts commit fc16d9342116235fa86cf6ac163b17125bb4b50e.
* Lets try this again minus device ui
* Add popular nrf52 pro micro to the builds (#5523)
* Add MACAddress to config.yaml (#5506)
* Add MACAddress to config.yaml
* Better error handling on native, including failing to launch with blank MAC Address and real hardware.
* Re-arrange Mac Address handling and add MACAddressSource
* Bump portduino to remove macaddr function there
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Configure Seeed Xiao S3 RX enable pin (#5517)
* Create OpenWRT_One_mikroBUS_sx1262.yaml (#5529)
* tlora_v2_1_16: Unset BUTTON_PIN and BUTTON_NEED_PULLUP (#5535)
Unset BUTTON_PIN and BUTTON_NEED_PULLUP as the board ships without a user button.
Devices and users expecting a button on GPIO12 have to set [GPIO for user button](https://meshtastic.org/docs/configuration/radio/device/#gpio-for-user-button) to 12 (or any GPIO pin the momentary switch was connected to) to restore functionality.
Signed-off-by: Andrew Yong <me@ndoo.sg>
* [create-pull-request] automated change (#5530)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Fix detection for some RadSens hardware versions (#5542)
Co-authored-by: Jake-B <jake-b@users.noreply.github.com>
* Initialize dmac array to nulls (#5538)
* Initialize dmac array to nulls
* Use std::cout for print before console is init.
* Update OpenWRT_One_mikroBUS_sx1262.yaml (#5544)
* Add portduino-buildroot variant (#5540)
* Add portduino-buildroot variant
* Update platform-native for platform-buildroot
* portduino-buildroot: Define c standard (#5547)
* Portduino: Move meshtasticd/web out of /usr/share/doc/ (#5548)
* Portduino: fix transitional symlinks (#5550)
* Windows Support - Trunk and Platformio (#5397) (#5518)
* Add support for GPG
* Add usb device support
* Add trunk.io to devcontainer
* Trunk things
* trunk fmt
* formatting
* fix trivy/DS002, checkov/CKV_DOCKER_3
* hide docker extension popup
* fix trivy/DS026, checkov/CKV_DOCKER_2
Co-authored-by: Kalle Lilja <15094562+ThatKalle@users.noreply.github.com>
* Synch minor changes from TFT branch (#5520)
* Synch minor changes from TFT branch
Includes:
* New nordicnrf52 minor version (10.5.0 --> 10.6.0)
* Optimisations for T_DECK
* preparation for MESH_TAB
* add ext notification module to portduino
---------
Co-authored-by: mverch67 <manuel.verch@gmx.de>
* DIO3_TCXO_VOLTAGE in config.yaml can now take an exact voltage (#5558)
* Support TLORA_V3.0 (#5563)
- Support TLORA_V3.0. Update of the legendary 2.1_1.6.1 with solar charger, TCXO and IPEX connector.
- 'extra' some short-lived EOL intermediate boards in that range. If possible use T3S3 instead of all of these!
- update trunk to latest version
* Create OpenWRT-One-mikroBUS-LR-IOT-CLICK.yaml (#5564)
* Portduino: fix setting hwId via argument (#5565)
* INA219 charging detection
minimal implementation: if there is a configured INA219 sensor for battery monitoring we can take the current flow across the shunt resistor to know if we are charging the battery - negative milliamps indicate charging
* Update Power.cpp
added comments and 2 extra defines to disable and swap detection direction
* Trunk Fixes
* Add INA226 support
---------
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
Signed-off-by: Andrew Yong <me@ndoo.sg>
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz>
Co-authored-by: GUVWAF <78759985+GUVWAF@users.noreply.github.com>
Co-authored-by: Tom Fifield <tom@tomfifield.net>
Co-authored-by: Michael Gjelsø <36234524+gjelsoe@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
Co-authored-by: jcyrio <50239349+jcyrio@users.noreply.github.com>
Co-authored-by: Daniel.Cao <144674500+DanielCao0@users.noreply.github.com>
Co-authored-by: Catalin Patulea <cronos586@gmail.com>
Co-authored-by: dylanli <dylan3000dylan@gmail.com>
Co-authored-by: mverch67 <manuel.verch@gmx.de>
Co-authored-by: madeofstown <33820964+madeofstown@users.noreply.github.com>
Co-authored-by: Christopher Hoover <ch@murgatroid.com>
Co-authored-by: Mictronics <github@mictronics.de>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
Co-authored-by: caveman99 <25002+caveman99@users.noreply.github.com>
Co-authored-by: jake-b <1012393+jake-b@users.noreply.github.com>
Co-authored-by: César de Tassis Filho <CTassisF@users.noreply.github.com>
Co-authored-by: Tomas Dubec <tomas.dubec@gmail.com>
Co-authored-by: Liam Cottle <liam@liamcottle.com>
Co-authored-by: panaceya <panaceya@users.noreply.github.com>
Co-authored-by: virgil <virgil.wang.cj@gmail.com>
Co-authored-by: Robert <r@rbrt.io>
Co-authored-by: noon92 <40807970+noon92@users.noreply.github.com>
Co-authored-by: Mark Trevor Birss <markbirss@gmail.com>
Co-authored-by: broglep <20624281+broglep@users.noreply.github.com>
Co-authored-by: Matthias Granberry <matthias.granberry@gmail.com>
Co-authored-by: Andrew Yong <me@ndoo.sg>
Co-authored-by: Jake-B <jake-b@users.noreply.github.com>
Co-authored-by: Austin <vidplace7@gmail.com>
Co-authored-by: Kalle Lilja <15094562+ThatKalle@users.noreply.github.com>
2024-12-22 05:02:50 +01:00
|
|
|
|
int16_t getINACurrent()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA219].first == config.power.device_battery_ina_address) {
|
|
|
|
|
|
return ina219Sensor.getCurrentMa();
|
|
|
|
|
|
} else if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA226].first ==
|
|
|
|
|
|
config.power.device_battery_ina_address) {
|
|
|
|
|
|
return ina226Sensor.getCurrentMa();
|
|
|
|
|
|
} else if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA3221].first ==
|
|
|
|
|
|
config.power.device_battery_ina_address) {
|
|
|
|
|
|
return ina3221Sensor.getCurrentMa();
|
|
|
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-06-02 06:32:34 -05:00
|
|
|
|
bool hasINA()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!config.power.device_battery_ina_address) {
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
2023-10-15 02:33:45 +02:00
|
|
|
|
if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA219].first == config.power.device_battery_ina_address) {
|
2023-06-02 06:32:34 -05:00
|
|
|
|
if (!ina219Sensor.isInitialized())
|
|
|
|
|
|
return ina219Sensor.runOnce() > 0;
|
|
|
|
|
|
return ina219Sensor.isRunning();
|
Detect charging status by measuring current flow with configured INA battery sensor (#5271)
* INA219 charging detection
minimal implementation: if there is a configured INA219 sensor for battery monitoring we can take the current flow across the shunt resistor to know if we are charging the battery - negative milliamps indicate charging
* Update Power.cpp
added comments and 2 extra defines to disable and swap detection direction
* Update Power.cpp
fix disabled case
* move getCurrentMa() to new CurrentSensor class
* INA219 charging detection
minimal implementation: if there is a configured INA219 sensor for battery monitoring we can take the current flow across the shunt resistor to know if we are charging the battery - negative milliamps indicate charging
* Update Power.cpp
added comments and 2 extra defines to disable and swap detection direction
* Update Power.cpp
fix disabled case
* move getCurrentMa() to new CurrentSensor class
* add INA3221 charging detection
* RP2040: Update core; add mDNS support (#5355)
* Update arduino-pico core
* RP2040: Add mDNS support
* SimpleMDNS `begin` now returns a bool
* Add `-g` option to `debug_build_flags` to link files for gdb
* RAK11310 needs old platform as well
* Change defines to specific architecture
* Core version 4.2.1 is out
* Add sudo to apt-get commands for Raspbian Build (#5364)
Without sudo, inadequate permissions to runs the commands meant
the build was failing.
* Typo fix in build_raspbian.yml (#5365)
s/sudp/sudo :(:(:(
* Rework some things
* Trunk
* Separate littlefs bundle
* version tags
* Diag
* Add littlefswebui
* Bug fixed in ExternalNotificationModule (#5375)
While `nagging` setExternalState wasn't written to Buzzer & Vibra so output was never toggled.
Possible fix for #5348
* Cleanup static files from bad Web UI bundle on 2.5.13 release (#5376)
* Cleanup static files from bad Web UI bundle on 2.5.13 release
* Check existence first
* Esp32 is the only one we care about
* Move some actions to after `startTransmit()` (#5383)
To minimize the time between channel scan and actual transmit
* [create-pull-request] automated change (#5380)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Allows all 3 PKI keys to be added to userPrefs.h (#4969) and a tool. (#5368)
* more userPrefs.h
Added PKI Admin keys to userPrefs.h
* Update userPrefs.h
Allows all 3 PKI keys to be added to userPrefs.h (#4969)
* Update NodeDB.cpp
Trunk
* Update userPrefs.h
Changed wording
* Create base64_to_hex.py
A little tool for converting base64 PKI Keys to decoded byte that userPrefs.h can understand.
* more userPrefs.h
Added PKI Admin keys to userPrefs.h
* Update userPrefs.h
Allows all 3 PKI keys to be added to userPrefs.h (#4969)
* Update NodeDB.cpp
Trunk
* Update userPrefs.h
Changed wording
* Create base64_to_hex.py
A little tool for converting base64 PKI Keys to decoded byte that userPrefs.h can understand.
* [create-pull-request] automated change (#5388)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* add smiley emoji (#5391)
* add smiley emoji
* clang-formatted
* Anable trace route function on wismeshtap platform (#5389)
* fix 'symbal' typo (#5395)
* [create-pull-request] automated change (#5399)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* /api/v1/fromradio: add OPTIONS handler for CORS. (#5386)
This avoids hitting the 404 Not Found handler, which breaks connection
keep-alive, so this change fixes a big performance regression for Web Client in
Chrome: https://github.com/meshtastic/firmware/issues/5385
Tested on Heltec V3.
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Make heart emoji usable (#5403)
* Create a specific hw_model for WisMesh Tap (#5400)
* Create a specific hw_model for WisMesh Tap
* Trunk
* HAS_ETHERNET
* Remove it altogether
* Don't need these either
* Fix RTC time injection and consolidate position logic (#5396)
* Fix RTC time injection and consolidate position logic
* Comment out unused var warning
* Backerds
* Update arduino-pico core to fix sporadic hangs (#5406)
* Update platform-raspberrypi also (#5407)
* Update arduino-pico core to fix sporadic hangs
* Update platform-raspberrypi also
* --web added to device-install(.sh/.bat) (#5405)
* Add --web
* Update device-install.bat
Forgot a "-" a few places.
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* add GPS in indicator board (#5411)
* Fixed NMEA sentence issue in CalTopo as well as bug with no printing all of the nodes (#5412)
* --web littlefswebui-* typo fix (#5416)
* Add --web
* Update device-install.bat
Forgot a "-" a few places.
* Typo fix.
* Typo fix
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: GUVWAF <78759985+GUVWAF@users.noreply.github.com>
* Temporarily disable MDNS when MQTT is enabled (#5418)
Leads to a panic
* Check for OkToMqtt flag presence before uplinking to MQTT (#5413)
* Check for oktomqtt flag presence before uplinking to MQTT
* Move to mqtt->onSend
* Temetry can respond to want-response for LocalStats variant (#5414)
* Seems like the last DIY board that's not "extra" (#5420)
* Cherry pick tdeck fixes (#5422)
* Try-fix (workaround) T-Deck audio crash
* set T-Deck audio to unused 48 (mem mclk)
* swap mclk to gpio 21
* dreamcatcher: assign GPIO44 to audio mclk
---------
Co-authored-by: mverch67 <manuel.verch@gmx.de>
* add canned message and keyboard in indicator board (#5410)
* add canned message and keyboard in indicator board
* Added virtual keyboard macro and enabled for Indicator
* Cleanup macros by applying USE_VIRTUAL_KEYBOARD and DISPLAY_CLOCK_FRAME
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Update build-native.sh (#5415)
* Update build-native.sh
Device-install.sh and device-update.sh are not used on native platform, skip copying to release directory after build and copy native-install.sh and native-run.sh instead.
* Update build-native.sh
Skip native-run.sh copy
* Cleans up visibility in GPS.h (#5426)
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
* Fix admin key loading from userPrefs.h (#5417)
* 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
* Fix warning: extra tokens at end of #endif directive.
* Fix antenna switching logic. Complementary-pin control logic is required on the rp2040-lora board.
* Fix deprecated macros.
* Set RP2040 in dormant mode when deep sleep is triggered.
* Fix array out of bounds read.
* Admin key count needs to be set otherwise the key will be zero loaded after reset.
* Don't reset the admin key size when loading defaults. Preserve an existing key in config if possible.
* Remove log spam when reading INA voltage sensor.
* Remove static declaration for admin keys from userPrefs.h. Load hard coded admin keys in case config file has empty slots.
* Removed newlines from log.
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
* try to detect dfrobot station to tell it apart from an ublox gps. (#5393)
* Remove BMA-423 and STK8X by default (#5429)
* Remove BMA-423 by default
* STK
* Wrong macro
* Helps if you include the file
* [create-pull-request] automated change (#5431)
Co-authored-by: caveman99 <25002+caveman99@users.noreply.github.com>
* Support for the ClimateGuard RadSens Geiger-Muller tube (#5425)
* fixes https://github.com/meshtastic/firmware/issues/5434 (#5435)
* update libpax
* fix interval init
* Fix memory leaks by adding missing `free()` calls before early returns in `MQTT::onReceive` (#5439)
This fix addresses memory leaks in the `MQTT::onReceive` function by ensuring that dynamically allocated resources (`e.channel_id`, `e.gateway_id` and `e.packet`) are properly freed before each early return. Previously, these resources were only freed at the end of the function, leaving them unhandled in certain exit paths. Adding the missing `free()` calls prevents memory leaks and ensures proper resource cleanup in all scenarios.
* Removing 1.0 legacy boards from releases and completely removing Heltec wireless capsule from support (#5436)
Co-authored-by: Tom Fifield <tom@tomfifield.net>
* A second round of cleanup on GPS.h. (#5433)
* Move yet more stuff out of GPS.h and into file scope.
* Protect code macros from eating semicolons.
* Remove unused (and unimplemented) getDOPString.
* clang-format with project style file on affected files.
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
* enable MQTT with TLS on RPi picow (#5442)
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Don't powersave on Wifi (#5443)
* Don't go into light sleep with wifi enabled
* Move
* Trunk
* Revert "Seems like the last DIY board that's not "extra" (#5420)" (#5446)
This reverts commit e6fb6b115aebb12b31fb93ed9d1508a6109b2f03.
* Actually gunzip all the files when building a .deb (#5449)
* [create-pull-request] automated change (#5457)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Cleanup i2c scan logs and macro to save some bytes and remain consistent (#5455)
* Cleanup i2c scan logs and macro to save some bytes and remain consistent
* Functions are better than macros
* Exclude i2c scan for STM32
* Useless log
* Clean up some inline functions (#5454)
* Use isWithinTimespanMs to avoid refererence to NodeDb instance inside of NodeDb (#5453)
* fix cors for meshtasticd to allow use of cross origin clients (#5463)
* Remove ATECC crypto chip placeholder code (#5461)
* GPS.h cleanups round 3. (#5447)
* GPS.h cleanups round 3.
No effective behavior change.
Protected members can be private so make it so. (Supporting
subclasses needs a lot more work.)
Moves uBloxGnssModelInfo into file scope.
Moves uBloxProtocolVersion into uBloxGnssModelInfo.
Moves baud rate arrays into file scope.
Removes unused/ unimplemented powerStateToString.
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
* Trunk Format.
---------
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
Co-authored-by: Tom Fifield <tom@tomfifield.net>
* Fix ukrainian fonts (#5468)
* FIX: rollback to !4624
* UPDATE: new 16 and 24 UA Fonts and fixes
* fix: Solve the lightsleep crash problem via disable lightsleep for indicator. (#5470)
* Trunk
* Warnings and log cleanup (#5472)
* Don't log if keyboard not found
* Signed comparison issue
* [create-pull-request] automated change (#5475)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Adds libusb dev package to Raspbian build steps (#5480)
* [create-pull-request] automated change (#5478)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Portduino fixes (#5479)
* Set config.yaml defaults even if General is missing
* Unsigned values should get %u in logging
* Update arduino-pico core and remove MDNS restriction (#5483)
* Update xiao_esp32 fully support L67K (#5488)
L67K module hardware changed
* Convert userprefs to a json file instead of header file which has to be included everywhere (#5471)
* WIP
* Got string quoting and macro expansion working
* Need the placeholder
* Cleanup
* Missed a user prefs reference
* Update jsonc
* SimRadio: clean-up and emulate collisions (#5487)
* Clean up SimRadio and don't let it use PKC
* Add collision emulation for SimRadio
* Add stats from SimRadio to LocalStats
* Make emulating collisions optional
* add nodeId to nodeinfo update log lines and removed redundant nodeinfo update log line (#5493)
* Refact the macro definition of GPS initialization of GPSDEFAULTD_NOT_PRESENT and added seeeed Indicator to this sequence (#5494)
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Extend Length of Source and Destination Node IDs Logged (#5492)
* show 8 chars for logging source and destination ids
* extend legnth of source and destination nodes in log
* Added femtofox configs (#5477)
* added femtofox configs
* Rename bin/config.d/femtofox_Waveshare-SX126X-XXXM_AI-Thinker-RA-01SH.yaml to bin/config.d/femtofox/femtofox_Waveshare-SX126X-XXXM_AI-Thinker-RA-01SH.yaml
* moved femtofox configs to subdir
* [Add] LR1110, LR1120 and LR1121 to linux native Portduino (#5496)
* Update main.cpp
* Update PortduinoGlue.h
* Update PortduinoGlue.cpp
* Update PortduinoGlue.cpp
* Update PortduinoGlue.cpp
* Update main.cpp
* [create-pull-request] automated change (#5500)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Fix minor typos in package workflows (#5505)
* Don't use channel index for encrypted packet (#5509)
* Don't use channel index for encrypted packet
* Remove assert in `getKey`, set invalid key length
So encrypting will fail without reboot
* Reset channel to 0 when unable to encrypt
Such that the NAK doesn't use the failing channel hash
* Always Announce MDNS meshtastic service (#5503)
* refactor server api port into define
* always announce MDNS meshtastic service
* fix nodeDB erase loop when free mem returns invalid value (0, -1). (#5519)
Co-authored-by: mverch67 <manuel.verch@gmx.de>
* Add heltec capsule back
* Revert "Add heltec capsule back"
This reverts commit fc16d9342116235fa86cf6ac163b17125bb4b50e.
* Lets try this again minus device ui
* Add popular nrf52 pro micro to the builds (#5523)
* Add MACAddress to config.yaml (#5506)
* Add MACAddress to config.yaml
* Better error handling on native, including failing to launch with blank MAC Address and real hardware.
* Re-arrange Mac Address handling and add MACAddressSource
* Bump portduino to remove macaddr function there
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Configure Seeed Xiao S3 RX enable pin (#5517)
* Create OpenWRT_One_mikroBUS_sx1262.yaml (#5529)
* tlora_v2_1_16: Unset BUTTON_PIN and BUTTON_NEED_PULLUP (#5535)
Unset BUTTON_PIN and BUTTON_NEED_PULLUP as the board ships without a user button.
Devices and users expecting a button on GPIO12 have to set [GPIO for user button](https://meshtastic.org/docs/configuration/radio/device/#gpio-for-user-button) to 12 (or any GPIO pin the momentary switch was connected to) to restore functionality.
Signed-off-by: Andrew Yong <me@ndoo.sg>
* [create-pull-request] automated change (#5530)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Fix detection for some RadSens hardware versions (#5542)
Co-authored-by: Jake-B <jake-b@users.noreply.github.com>
* Initialize dmac array to nulls (#5538)
* Initialize dmac array to nulls
* Use std::cout for print before console is init.
* Update OpenWRT_One_mikroBUS_sx1262.yaml (#5544)
* Add portduino-buildroot variant (#5540)
* Add portduino-buildroot variant
* Update platform-native for platform-buildroot
* portduino-buildroot: Define c standard (#5547)
* Portduino: Move meshtasticd/web out of /usr/share/doc/ (#5548)
* Portduino: fix transitional symlinks (#5550)
* Windows Support - Trunk and Platformio (#5397) (#5518)
* Add support for GPG
* Add usb device support
* Add trunk.io to devcontainer
* Trunk things
* trunk fmt
* formatting
* fix trivy/DS002, checkov/CKV_DOCKER_3
* hide docker extension popup
* fix trivy/DS026, checkov/CKV_DOCKER_2
Co-authored-by: Kalle Lilja <15094562+ThatKalle@users.noreply.github.com>
* Synch minor changes from TFT branch (#5520)
* Synch minor changes from TFT branch
Includes:
* New nordicnrf52 minor version (10.5.0 --> 10.6.0)
* Optimisations for T_DECK
* preparation for MESH_TAB
* add ext notification module to portduino
---------
Co-authored-by: mverch67 <manuel.verch@gmx.de>
* DIO3_TCXO_VOLTAGE in config.yaml can now take an exact voltage (#5558)
* Support TLORA_V3.0 (#5563)
- Support TLORA_V3.0. Update of the legendary 2.1_1.6.1 with solar charger, TCXO and IPEX connector.
- 'extra' some short-lived EOL intermediate boards in that range. If possible use T3S3 instead of all of these!
- update trunk to latest version
* Create OpenWRT-One-mikroBUS-LR-IOT-CLICK.yaml (#5564)
* Portduino: fix setting hwId via argument (#5565)
* INA219 charging detection
minimal implementation: if there is a configured INA219 sensor for battery monitoring we can take the current flow across the shunt resistor to know if we are charging the battery - negative milliamps indicate charging
* Update Power.cpp
added comments and 2 extra defines to disable and swap detection direction
* Trunk Fixes
* Add INA226 support
---------
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
Signed-off-by: Andrew Yong <me@ndoo.sg>
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz>
Co-authored-by: GUVWAF <78759985+GUVWAF@users.noreply.github.com>
Co-authored-by: Tom Fifield <tom@tomfifield.net>
Co-authored-by: Michael Gjelsø <36234524+gjelsoe@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
Co-authored-by: jcyrio <50239349+jcyrio@users.noreply.github.com>
Co-authored-by: Daniel.Cao <144674500+DanielCao0@users.noreply.github.com>
Co-authored-by: Catalin Patulea <cronos586@gmail.com>
Co-authored-by: dylanli <dylan3000dylan@gmail.com>
Co-authored-by: mverch67 <manuel.verch@gmx.de>
Co-authored-by: madeofstown <33820964+madeofstown@users.noreply.github.com>
Co-authored-by: Christopher Hoover <ch@murgatroid.com>
Co-authored-by: Mictronics <github@mictronics.de>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
Co-authored-by: caveman99 <25002+caveman99@users.noreply.github.com>
Co-authored-by: jake-b <1012393+jake-b@users.noreply.github.com>
Co-authored-by: César de Tassis Filho <CTassisF@users.noreply.github.com>
Co-authored-by: Tomas Dubec <tomas.dubec@gmail.com>
Co-authored-by: Liam Cottle <liam@liamcottle.com>
Co-authored-by: panaceya <panaceya@users.noreply.github.com>
Co-authored-by: virgil <virgil.wang.cj@gmail.com>
Co-authored-by: Robert <r@rbrt.io>
Co-authored-by: noon92 <40807970+noon92@users.noreply.github.com>
Co-authored-by: Mark Trevor Birss <markbirss@gmail.com>
Co-authored-by: broglep <20624281+broglep@users.noreply.github.com>
Co-authored-by: Matthias Granberry <matthias.granberry@gmail.com>
Co-authored-by: Andrew Yong <me@ndoo.sg>
Co-authored-by: Jake-B <jake-b@users.noreply.github.com>
Co-authored-by: Austin <vidplace7@gmail.com>
Co-authored-by: Kalle Lilja <15094562+ThatKalle@users.noreply.github.com>
2024-12-22 05:02:50 +01:00
|
|
|
|
} else if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA226].first ==
|
|
|
|
|
|
config.power.device_battery_ina_address) {
|
|
|
|
|
|
if (!ina226Sensor.isInitialized())
|
|
|
|
|
|
return ina226Sensor.runOnce() > 0;
|
2023-10-15 02:33:45 +02:00
|
|
|
|
} else if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA260].first ==
|
|
|
|
|
|
config.power.device_battery_ina_address) {
|
2023-06-02 06:32:34 -05:00
|
|
|
|
if (!ina260Sensor.isInitialized())
|
|
|
|
|
|
return ina260Sensor.runOnce() > 0;
|
|
|
|
|
|
return ina260Sensor.isRunning();
|
2024-07-11 14:34:55 +01:00
|
|
|
|
} else if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA3221].first ==
|
|
|
|
|
|
config.power.device_battery_ina_address) {
|
|
|
|
|
|
if (!ina3221Sensor.isInitialized())
|
|
|
|
|
|
return ina3221Sensor.runOnce() > 0;
|
|
|
|
|
|
return ina3221Sensor.isRunning();
|
2023-06-02 06:32:34 -05:00
|
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
2021-07-24 19:44:27 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
2024-08-02 18:20:44 -07:00
|
|
|
|
static AnalogBatteryLevel analogLevel;
|
2020-06-27 21:19:49 -07:00
|
|
|
|
|
2022-05-07 20:31:21 +10:00
|
|
|
|
Power::Power() : OSThread("Power")
|
|
|
|
|
|
{
|
2022-01-24 07:00:14 +00:00
|
|
|
|
statusHandler = {};
|
|
|
|
|
|
low_voltage_counter = 0;
|
2022-12-16 20:46:43 +01:00
|
|
|
|
#ifdef DEBUG_HEAP
|
2023-02-17 12:31:51 +01:00
|
|
|
|
lastheap = memGet.getFreeHeap();
|
2022-12-16 20:46:43 +01:00
|
|
|
|
#endif
|
2022-01-24 07:00:14 +00:00
|
|
|
|
}
|
2020-10-09 14:16:51 +08:00
|
|
|
|
|
2020-08-12 17:03:36 -07:00
|
|
|
|
bool Power::analogInit()
|
|
|
|
|
|
{
|
2023-03-31 14:42:50 +03:00
|
|
|
|
#ifdef EXT_PWR_DETECT
|
2025-03-21 16:12:49 +01:00
|
|
|
|
#if defined(HELTEC_CAPSULE_SENSOR_V3) || defined(HELTEC_SENSOR_HUB)
|
2024-06-16 16:29:45 +02:00
|
|
|
|
pinMode(EXT_PWR_DETECT, INPUT_PULLUP);
|
|
|
|
|
|
#else
|
|
|
|
|
|
pinMode(EXT_PWR_DETECT, INPUT);
|
|
|
|
|
|
#endif
|
2023-03-31 14:42:50 +03:00
|
|
|
|
#endif
|
2024-03-12 17:55:31 +01:00
|
|
|
|
#ifdef EXT_CHRG_DETECT
|
|
|
|
|
|
pinMode(EXT_CHRG_DETECT, ext_chrg_detect_mode);
|
|
|
|
|
|
#endif
|
2023-03-31 14:42:50 +03:00
|
|
|
|
|
2020-08-12 17:03:36 -07:00
|
|
|
|
#ifdef BATTERY_PIN
|
2024-11-04 12:16:25 -06:00
|
|
|
|
LOG_DEBUG("Use analog input %d for battery level", BATTERY_PIN);
|
2020-10-16 17:00:27 +08:00
|
|
|
|
|
|
|
|
|
|
// disable any internal pullups
|
2023-05-16 01:40:42 -04:00
|
|
|
|
pinMode(BATTERY_PIN, INPUT);
|
2023-05-13 20:38:37 -04:00
|
|
|
|
|
|
|
|
|
|
#ifndef BATTERY_SENSE_RESOLUTION_BITS
|
2023-05-16 01:40:42 -04:00
|
|
|
|
#define BATTERY_SENSE_RESOLUTION_BITS 10
|
2023-05-13 20:38:37 -04:00
|
|
|
|
#endif
|
2020-10-16 17:00:27 +08:00
|
|
|
|
|
2023-05-16 01:40:42 -04:00
|
|
|
|
#ifdef ARCH_ESP32 // ESP32 needs special analog stuff
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef ADC_WIDTH // max resolution by default
|
|
|
|
|
|
static const adc_bits_width_t width = ADC_WIDTH_BIT_12;
|
|
|
|
|
|
#else
|
|
|
|
|
|
static const adc_bits_width_t width = ADC_WIDTH;
|
|
|
|
|
|
#endif
|
2023-05-13 20:38:37 -04:00
|
|
|
|
#ifndef BAT_MEASURE_ADC_UNIT // ADC1
|
|
|
|
|
|
adc1_config_width(width);
|
|
|
|
|
|
adc1_config_channel_atten(adc_channel, atten);
|
|
|
|
|
|
#else // ADC2
|
|
|
|
|
|
adc2_config_channel_atten(adc_channel, atten);
|
2024-02-14 05:20:48 +13:00
|
|
|
|
#ifndef CONFIG_IDF_TARGET_ESP32S3
|
2023-05-14 19:49:08 -04:00
|
|
|
|
// ADC2 wifi bug workaround
|
2024-02-14 05:20:48 +13:00
|
|
|
|
// Not required with ESP32S3, breaks compile
|
2023-05-13 20:38:37 -04:00
|
|
|
|
RTC_reg_b = READ_PERI_REG(SENS_SAR_READ_CTRL2_REG);
|
2024-02-14 05:20:48 +13:00
|
|
|
|
#endif
|
2020-09-26 18:13:16 -07:00
|
|
|
|
#endif
|
2023-05-13 20:38:37 -04:00
|
|
|
|
// calibrate ADC
|
|
|
|
|
|
esp_adc_cal_value_t val_type = esp_adc_cal_characterize(unit, atten, width, DEFAULT_VREF, adc_characs);
|
|
|
|
|
|
// show ADC characterization base
|
|
|
|
|
|
if (val_type == ESP_ADC_CAL_VAL_EFUSE_TP) {
|
2024-11-04 12:16:25 -06:00
|
|
|
|
LOG_INFO("ADC config based on Two Point values stored in eFuse");
|
2023-05-13 20:38:37 -04:00
|
|
|
|
} else if (val_type == ESP_ADC_CAL_VAL_EFUSE_VREF) {
|
2024-11-04 12:16:25 -06:00
|
|
|
|
LOG_INFO("ADC config based on reference voltage stored in eFuse");
|
2024-02-14 05:20:48 +13:00
|
|
|
|
}
|
|
|
|
|
|
#ifdef CONFIG_IDF_TARGET_ESP32S3
|
|
|
|
|
|
// ESP32S3
|
|
|
|
|
|
else if (val_type == ESP_ADC_CAL_VAL_EFUSE_TP_FIT) {
|
2024-11-04 12:16:25 -06:00
|
|
|
|
LOG_INFO("ADC config based on Two Point values and fitting curve coefficients stored in eFuse");
|
2024-02-14 05:20:48 +13:00
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
else {
|
2024-11-04 12:16:25 -06:00
|
|
|
|
LOG_INFO("ADC config based on default reference voltage");
|
2023-05-13 20:38:37 -04:00
|
|
|
|
}
|
|
|
|
|
|
#endif // ARCH_ESP32
|
|
|
|
|
|
|
2022-07-31 07:11:47 -05:00
|
|
|
|
#ifdef ARCH_NRF52
|
2021-07-24 19:44:27 +02:00
|
|
|
|
#ifdef VBAT_AR_INTERNAL
|
2022-05-07 20:31:21 +10:00
|
|
|
|
analogReference(VBAT_AR_INTERNAL);
|
2021-07-24 19:44:27 +02:00
|
|
|
|
#else
|
2020-10-16 17:00:27 +08:00
|
|
|
|
analogReference(AR_INTERNAL); // 3.6V
|
|
|
|
|
|
#endif
|
2023-05-13 20:38:37 -04:00
|
|
|
|
#endif // ARCH_NRF52
|
2024-02-11 19:20:20 +01:00
|
|
|
|
|
|
|
|
|
|
#ifndef ARCH_ESP32
|
2024-02-08 20:46:22 +00:00
|
|
|
|
analogReadResolution(BATTERY_SENSE_RESOLUTION_BITS);
|
2024-02-11 19:20:20 +01:00
|
|
|
|
#endif
|
2024-02-08 14:56:46 -06:00
|
|
|
|
|
2020-08-12 17:03:36 -07:00
|
|
|
|
batteryLevel = &analogLevel;
|
|
|
|
|
|
return true;
|
|
|
|
|
|
#else
|
|
|
|
|
|
return false;
|
2023-05-16 13:05:45 -04:00
|
|
|
|
#endif
|
2020-08-12 17:03:36 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-07-26 16:48:04 -07:00
|
|
|
|
/**
|
|
|
|
|
|
* Initializes the Power class.
|
2023-07-26 16:58:14 -07:00
|
|
|
|
*
|
2023-07-26 16:48:04 -07:00
|
|
|
|
* @return true if the setup was successful, false otherwise.
|
|
|
|
|
|
*/
|
2020-08-12 17:03:36 -07:00
|
|
|
|
bool Power::setup()
|
|
|
|
|
|
{
|
Unify the native display config between legacy display and MUI (#6838)
* Add missed include
* Another Warning fix
* Add another HAS_SCREEN
* Namespace fixes
* Removed depricated destination types and re-factored destination screen
* Get rid of Arduino Strings
* Clean up after Copilot
* SixthLine Def, Screen Rename
Added Sixth Line Definition Screen Rename, and Automatic Line Adjustment
* Consistency is hard - fixed "Sixth"
* System Frame Updates
Adjusted line construction to ensure we fit maximum content per screen.
* Fix up notifications
* Add a couple more ifdef HAS_SCREEN lines
* Add screen->isOverlayBannerShowing()
* Don't forget the invert!
* Adjust Nodelist Center Divider
Adjust Nodelist Center Divider
* Fix variable casting
* Fix entryText variable as empty before update to fix validation
* Altitude is int32_t
* Update PowerTelemetry to have correct data type
* Fix cppcheck warnings (#6945)
* Fix cppcheck warnings
* Adjust logic in Power.cpp for power sensor
---------
Co-authored-by: Jason P <applewiz@mac.com>
* More pixel wrangling so things line up NodeList edition
* Adjust NodeList alignments and plumb some background padding for a possible title fix
* Better alignment for banner notifications
* Move title into drawCommonHeader; initial screen tested
* Fonts make spacing items difficult
* Improved beeping booping and other buzzer based feedback (#6947)
* Improved beeping booping and other buzzer based feedback
* audible button feedback (#6949)
* Refactor
---------
Co-authored-by: todd-herbert <herbert.todd@gmail.com>
* Sandpapered the corners of the notification popup
* Finalize drawCommonHeader migration
* Update Title of Favorite Node Screens
* Update node metric alignment on LoRa screen
* Update the border for popups to separate it from background
* Update PaxcounterModule.cpp with CommonHeader
* Update WiFi screen with CommonHeader and related data reflow
* It was not, in fact, pointing up
* Fix build on wismeshtap
* T-deck trackball debounce
* Fix uptime on Device Focused page to actually detail
* Update Sys screen for new uptime, add label to Freq/Chan on LoRa
* Don't display DOP any longer, make Uptime consistent
* Revert Uptime change on Favorites, Apply to Device Focused
* Label the satelite number to avoid confusion
* Boop boop boop boop
* Correct GPS positioning and string consistency across strings for GPS
* Fix GPS text alignment
* Enable canned messages by default
* Don't wake screen on new nodes
* Cannedmessage list emote support added
* Fn+e emote picker for freetext screen
* Actually block CannedInput actions while display is shown
* Add selection menu to bannerOverlay
* Off by one
* Move to unified text layouts and spacing
* Still my Fav without an "e"
* Fully remove EVENT_NODEDB_UPDATED
* Simply LoRa screen
* Make some char pointers const to fix compilation on native targets
* Update drawCompassNorth to include radius
* Fix warning
* button thread cleanup
* Pull OneButton handling from PowerFSM and add MUI switch (#6973)
* Trunk
* Onebutton Menu Support
* Add temporary clock icon
* Add gps location to fsi
* Banner message state reset
* Cast to char to satisfy compiler
* Better fast handling of input during banner
* Fix warning
* Derp
* oops
* Update ref
* Wire buzzer_mode
* remove legacy string->print()
* Only init screen if one found
* Unsigned Char
* More buttonThread cleaning
* screen.cpp button handling cleanup
* The Great Event Rename of 2025
* Fix the Radiomaster
* Missed trackball type change
* Remove unused function
* Make ButtonThread an InputBroker
* Coffee hadn't kicked in yet
* Add clock icon for Navigation Bar
* Restore clock screen definition code - whoops
* ExternalNotifications now observe inputBroker
* Clock rework (#6992)
* Move Clock bits into ClockRenderer space
* Rework clock into all device navigation
* T-Watch Actually Builds Different
* Compile fix
---------
Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz>
* Add AM/PM to Digital Clock
* Flip Seconds and AM/PM on Clock Display
* Tik-tok pixels are hard
* Fix builds on Thinknode M1
* Check for GPS and don't crash
* Don't endif til the end
* Rework the OneButton thread to be much less of a mess. (#6997)
* Rework the OneButton thread to be much less of a mess. And break lots of targets temporarily
* Update src/input/ButtonThread.h
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* fix GPS toggle
* Send the shutdown event, not just the kbchar
* Honor the back button in a notificaiton popup
* Draw the right size box for popup with options
* Try to un-break all the things
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* 24-hour Clock Should have leading zero, but not 12-hour
* Fixup some compile errors
* Add intRoutine to ButtonThread init, to get more responsive user button back
* Add Timezone picker
* Fix Warning
* Optionally set the initial selection for the chooser popup
* Make back buttons work in canned messages
* Drop the wrapper classes
* LonPressTime now configurable
* Clock Frame can not longer be blank; just add valid time
* Back buttons everywhere!
* Key Verification confirm banner
* Make Elecrow M* top button a back button
* Add settings saves
* EInk responsiveness fixes
* Linux Input Fixes
* Add Native Trackball/Joystick support, and move UserButton to Input
* No Flight Stick Mode
* Send input event
* Add Channel Utilization to Device Focused frame
* Don't shift screens when we draw new ones
* Add showOverlayBanner arguments to no-op
* trunk
* Default Native trackball to NC
* Fix crash in simulator mode
* Add longLong button press
* Get the args right
* Adjust Bluetooth Pairing Screen to account for bottom navigation.
* Trackball everywhere, and unPhone buttons
* Remap visionmaster secondary button to TB_UP
* Kill ScanAndSelect
* trunk
* No longer need the canned messages input filter
* All Canned All the time
* Fix stm32 compile error regarding inputBroker
* Unify tft lineheights (#7033)
* Create variable line heights based upon SCREEN_HEIGHT
* Refactor textPositions into method -> getTextPositions
* Update SharedUIDisplay.h
---------
Co-authored-by: Jason P <applewiz@mac.com>
* Adjust top distance for larger displays
* Adjust icon sizes for larger displays
* Fix Paxcounter compile errors after code updates
* Pixel wrangling to make larger screens fit better
* Alert frame has precedence over banner -- for now
* Unify on ALT_BUTTON
* Align AM/PM to the digit, not the segment on larger displays
* Move some global pin defines into configuration.h
* Scaffolding for BMM150 9-axis gyro
* Alt button behavior
* Don't add the blank GPS frames without HAS_GPS
* EVENT_NODEDB_UPDATED has been retired
* Clean out LOG_WARN messages from debugging
* Add dismiss message function
* Minor buttonThread cleanup
* Add BMM150 support
* Clean up last warning from dev
* Simplify bmm150 init return logic
* Add option to reply to messages
* Add minimal menu upon selecting home screen
* Move Messages to slot 2, rename GPS to Position, move variables nearer functional usage in Screen.cpp
* Properly dismiss message
* T-Deck Trackball press is not user button
* Add select on favorite frame to launch cannedMessage DM
* Minor wording change
* Less capital letters
* Fix empty message check, time isn't reliable
* drop dead code
* Make UIRenderer a static class instead of namespace
* Fix the select on favorite
* Check if message is empty early and then 'return'
* Add kb_found, and show the option to launch freetype if appropriate
* Ignore impossible touchscreen touches
* Auto scroll fix
* Move linebreak after "from" for banners to maximize screen usage.
* Center "No messages to show" on Message frame
* Start consolidating buzzer behavior
* Fixed signed / unsigned warning
* Cast second parameter of max() to make some targets happy
* Cast kbchar to (char) to make arduino string happy
* Shorten the notice of "No messages"
* Add buzzer mode chooser
* Add regionPicker to Lora icon
* Reduce line spacing and reorder Position screen to resolve overlapping issues
* Update message titles, fix GPS icons, add Back options
* Leftover boops
* Remove chirp
* Make the region selection dismissable when a region is already set
* Add read-aloud functionality on messages w/ esp8266sam
* "Last Heard" is a better label
* tweak the beep
* 5 options
* properly tear down freetext upon cancel
* de-convelute canned messages just a bit
* Correct height of Mail icon in navigation bar
* Remove unused warning
* Consolidate time methods into TimeFormatters
* Oops
* Change LoRa Picker Cancel to Back
* Tweak selection characters on Banner
* Message render not scrolling on 5th line
* More fixes for message scrolling
* Remove the safety next on text overflow - we found that root cause
* Add pin definitions to fix compilation for obscure target
* Don't let the touchscreen send unitialized kbchar values
* Make virtual KB just a bit quicker
* No more double tap, swipe!
* Left is left, and Right is right
* Update horizontal lightning bolt design
* Move from solid to dashed separator for Message Frame
* Single emote feature fix
* Manually sort overlapping elements for now
* Freetext and clearer choices
* Fix ESP32 InkHUD builds on the unify-tft branch (#7087)
* Remove BaseUI branding
* Capitalization is fun
* Revert Meshtastic Boot Frame Changes
* Add ANZ_433 LoRa region to picker
* Update settings.json
---------
Co-authored-by: HarukiToreda <116696711+HarukiToreda@users.noreply.github.com>
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Jason P <applewiz@mac.com>
Co-authored-by: todd-herbert <herbert.todd@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-21 06:36:04 -05:00
|
|
|
|
bool found = false;
|
|
|
|
|
|
if (axpChipInit()) {
|
|
|
|
|
|
found = true;
|
|
|
|
|
|
} else if (lipoInit()) {
|
|
|
|
|
|
found = true;
|
|
|
|
|
|
} else if (analogInit()) {
|
|
|
|
|
|
found = true;
|
|
|
|
|
|
}
|
2020-08-12 17:03:36 -07:00
|
|
|
|
|
2024-08-02 18:20:44 -07:00
|
|
|
|
#ifdef NRF_APM
|
|
|
|
|
|
found = true;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2020-10-09 14:16:51 +08:00
|
|
|
|
enabled = found;
|
2021-09-19 15:03:37 +02:00
|
|
|
|
low_voltage_counter = 0;
|
2020-08-12 17:03:36 -07:00
|
|
|
|
|
|
|
|
|
|
return found;
|
2020-06-27 21:19:49 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-11-22 19:01:48 -08:00
|
|
|
|
void Power::shutdown()
|
|
|
|
|
|
{
|
2025-07-20 18:53:40 -05:00
|
|
|
|
|
|
|
|
|
|
#if HAS_SCREEN
|
|
|
|
|
|
if (screen) {
|
|
|
|
|
|
screen->showSimpleBanner("Shutting Down...", 0); // stays on screen
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
2025-07-20 20:02:32 -05:00
|
|
|
|
#ifndef ARCH_STM32
|
2025-07-20 18:53:40 -05:00
|
|
|
|
playShutdownMelody();
|
2025-07-20 20:02:32 -05:00
|
|
|
|
#endif
|
2025-07-20 18:53:40 -05:00
|
|
|
|
nodeDB->saveToDisk();
|
2023-03-11 22:40:33 +01:00
|
|
|
|
|
2024-10-08 12:24:37 +02:00
|
|
|
|
#if defined(ARCH_NRF52) || defined(ARCH_ESP32) || defined(ARCH_RP2040)
|
2023-03-11 22:40:33 +01:00
|
|
|
|
#ifdef PIN_LED1
|
2022-06-06 18:48:22 +02:00
|
|
|
|
ledOff(PIN_LED1);
|
2023-03-11 22:40:33 +01:00
|
|
|
|
#endif
|
|
|
|
|
|
#ifdef PIN_LED2
|
2022-06-06 18:48:22 +02:00
|
|
|
|
ledOff(PIN_LED2);
|
2023-03-11 22:40:33 +01:00
|
|
|
|
#endif
|
|
|
|
|
|
#ifdef PIN_LED3
|
2023-12-02 12:30:00 +00:00
|
|
|
|
ledOff(PIN_LED3);
|
2023-03-11 22:40:33 +01:00
|
|
|
|
#endif
|
2025-07-20 18:53:40 -05:00
|
|
|
|
doDeepSleep(DELAY_FOREVER, false, true);
|
|
|
|
|
|
#elif defined(ARCH_PORTDUINO)
|
|
|
|
|
|
exit(EXIT_SUCCESS);
|
|
|
|
|
|
#else
|
|
|
|
|
|
LOG_WARN("FIXME implement shutdown for this platform");
|
2020-11-22 19:01:48 -08:00
|
|
|
|
#endif
|
2020-11-22 18:50:14 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-06-27 21:19:49 -07:00
|
|
|
|
/// Reads power status to powerStatus singleton.
|
|
|
|
|
|
//
|
|
|
|
|
|
// TODO(girts): move this and other axp stuff to power.h/power.cpp.
|
|
|
|
|
|
void Power::readPowerStatus()
|
|
|
|
|
|
{
|
2024-08-02 18:20:44 -07:00
|
|
|
|
int32_t batteryVoltageMv = -1; // Assume unknown
|
|
|
|
|
|
int8_t batteryChargePercent = -1;
|
|
|
|
|
|
OptionalBool usbPowered = OptUnknown;
|
|
|
|
|
|
OptionalBool hasBattery = OptUnknown; // These must be static because NRF_APM code doesn't run every time
|
2025-03-29 14:14:24 +01:00
|
|
|
|
OptionalBool isChargingNow = OptUnknown;
|
2024-08-02 18:20:44 -07:00
|
|
|
|
|
2020-08-12 17:03:36 -07:00
|
|
|
|
if (batteryLevel) {
|
2024-08-02 18:20:44 -07:00
|
|
|
|
hasBattery = batteryLevel->isBatteryConnect() ? OptTrue : OptFalse;
|
|
|
|
|
|
usbPowered = batteryLevel->isVbusIn() ? OptTrue : OptFalse;
|
2025-03-29 14:14:24 +01:00
|
|
|
|
isChargingNow = batteryLevel->isCharging() ? OptTrue : OptFalse;
|
2020-08-12 17:03:36 -07:00
|
|
|
|
if (hasBattery) {
|
|
|
|
|
|
batteryVoltageMv = batteryLevel->getBattVoltage();
|
|
|
|
|
|
// If the AXP192 returns a valid battery percentage, use it
|
2022-09-06 15:58:33 +08:00
|
|
|
|
if (batteryLevel->getBatteryPercent() >= 0) {
|
|
|
|
|
|
batteryChargePercent = batteryLevel->getBatteryPercent();
|
2020-08-12 17:03:36 -07:00
|
|
|
|
} else {
|
|
|
|
|
|
// If the AXP192 returns a percentage less than 0, the feature is either not supported or there is an error
|
2024-11-02 20:25:05 -05:00
|
|
|
|
// In that case, we compute an estimate of the charge percent based on open circuit voltage table defined
|
2024-02-16 13:09:57 +01:00
|
|
|
|
// in power.h
|
|
|
|
|
|
batteryChargePercent = clamp((int)(((batteryVoltageMv - (OCV[NUM_OCV_POINTS - 1] * NUM_CELLS)) * 1e2) /
|
|
|
|
|
|
((OCV[0] * NUM_CELLS) - (OCV[NUM_OCV_POINTS - 1] * NUM_CELLS))),
|
|
|
|
|
|
0, 100);
|
2020-08-12 17:03:36 -07:00
|
|
|
|
}
|
2020-06-27 21:19:49 -07:00
|
|
|
|
}
|
2024-08-02 18:20:44 -07:00
|
|
|
|
}
|
2020-06-28 18:17:52 -07:00
|
|
|
|
|
2024-08-02 18:20:44 -07:00
|
|
|
|
// FIXME: IMO we shouldn't be littering our code with all these ifdefs. Way better instead to make a Nrf52IsUsbPowered subclass
|
|
|
|
|
|
// (which shares a superclass with the BatteryLevel stuff)
|
|
|
|
|
|
// that just provides a few methods. But in the interest of fixing this bug I'm going to follow current
|
|
|
|
|
|
// practice.
|
2023-11-22 09:30:55 -07:00
|
|
|
|
#ifdef NRF_APM // Section of code detects USB power on the RAK4631 and updates the power states. Takes 20 seconds or so to detect
|
|
|
|
|
|
// changes.
|
|
|
|
|
|
|
2024-08-02 18:20:44 -07:00
|
|
|
|
nrfx_power_usb_state_t nrf_usb_state = nrfx_power_usbstatus_get();
|
2024-10-14 06:11:43 +02:00
|
|
|
|
// LOG_DEBUG("NRF Power %d", nrf_usb_state);
|
2023-11-22 09:30:55 -07:00
|
|
|
|
|
2024-08-02 18:20:44 -07:00
|
|
|
|
// If changed to DISCONNECTED
|
|
|
|
|
|
if (nrf_usb_state == NRFX_POWER_USB_STATE_DISCONNECTED)
|
2025-03-29 14:14:24 +01:00
|
|
|
|
isChargingNow = usbPowered = OptFalse;
|
2024-08-02 18:20:44 -07:00
|
|
|
|
// If changed to CONNECTED / READY
|
|
|
|
|
|
else
|
2025-03-29 14:14:24 +01:00
|
|
|
|
isChargingNow = usbPowered = OptTrue;
|
2024-05-22 08:58:05 +12:00
|
|
|
|
|
2023-11-22 09:30:55 -07:00
|
|
|
|
#endif
|
2024-08-02 18:20:44 -07:00
|
|
|
|
|
|
|
|
|
|
// Notify any status instances that are observing us
|
2025-03-29 14:14:24 +01:00
|
|
|
|
const PowerStatus powerStatus2 = PowerStatus(hasBattery, usbPowered, isChargingNow, batteryVoltageMv, batteryChargePercent);
|
2024-10-14 06:11:43 +02:00
|
|
|
|
LOG_DEBUG("Battery: usbPower=%d, isCharging=%d, batMv=%d, batPct=%d", powerStatus2.getHasUSB(), powerStatus2.getIsCharging(),
|
|
|
|
|
|
powerStatus2.getBatteryVoltageMv(), powerStatus2.getBatteryChargePercent());
|
2024-08-02 18:20:44 -07:00
|
|
|
|
newStatus.notifyObservers(&powerStatus2);
|
2022-11-30 09:52:28 +01:00
|
|
|
|
#ifdef DEBUG_HEAP
|
2024-08-02 18:20:44 -07:00
|
|
|
|
if (lastheap != memGet.getFreeHeap()) {
|
2024-10-14 06:11:43 +02:00
|
|
|
|
std::string threadlist = "Threads running:";
|
2024-08-02 18:20:44 -07:00
|
|
|
|
int running = 0;
|
|
|
|
|
|
for (int i = 0; i < MAX_THREADS; i++) {
|
|
|
|
|
|
auto thread = concurrency::mainController.get(i);
|
|
|
|
|
|
if ((thread != nullptr) && (thread->enabled)) {
|
2024-10-14 06:11:43 +02:00
|
|
|
|
threadlist += vformat(" %s", thread->ThreadName.c_str());
|
2024-08-02 18:20:44 -07:00
|
|
|
|
running++;
|
2022-12-30 17:03:48 +01:00
|
|
|
|
}
|
2022-12-16 20:25:51 +01:00
|
|
|
|
}
|
2024-10-14 06:11:43 +02:00
|
|
|
|
LOG_DEBUG(threadlist.c_str());
|
|
|
|
|
|
LOG_DEBUG("Heap status: %d/%d bytes free (%d), running %d/%d threads", memGet.getFreeHeap(), memGet.getHeapSize(),
|
2024-08-02 18:20:44 -07:00
|
|
|
|
memGet.getFreeHeap() - lastheap, running, concurrency::mainController.size(false));
|
|
|
|
|
|
lastheap = memGet.getFreeHeap();
|
|
|
|
|
|
}
|
2023-02-04 14:56:04 +01:00
|
|
|
|
#ifdef DEBUG_HEAP_MQTT
|
2024-08-02 18:20:44 -07:00
|
|
|
|
if (mqtt) {
|
|
|
|
|
|
// send MQTT-Packet with Heap-Size
|
|
|
|
|
|
uint8_t dmac[6];
|
|
|
|
|
|
getMacAddr(dmac); // Get our hardware ID
|
|
|
|
|
|
char mac[18];
|
|
|
|
|
|
sprintf(mac, "!%02x%02x%02x%02x", dmac[2], dmac[3], dmac[4], dmac[5]);
|
|
|
|
|
|
|
|
|
|
|
|
auto newHeap = memGet.getFreeHeap();
|
|
|
|
|
|
std::string heapTopic =
|
|
|
|
|
|
(*moduleConfig.mqtt.root ? moduleConfig.mqtt.root : "msh") + std::string("/2/heap/") + std::string(mac);
|
|
|
|
|
|
std::string heapString = std::to_string(newHeap);
|
|
|
|
|
|
mqtt->pubSub.publish(heapTopic.c_str(), heapString.c_str(), false);
|
|
|
|
|
|
auto wifiRSSI = WiFi.RSSI();
|
|
|
|
|
|
std::string wifiTopic =
|
|
|
|
|
|
(*moduleConfig.mqtt.root ? moduleConfig.mqtt.root : "msh") + std::string("/2/wifi/") + std::string(mac);
|
|
|
|
|
|
std::string wifiString = std::to_string(wifiRSSI);
|
|
|
|
|
|
mqtt->pubSub.publish(wifiTopic.c_str(), wifiString.c_str(), false);
|
|
|
|
|
|
}
|
2023-02-04 14:56:04 +01:00
|
|
|
|
#endif
|
|
|
|
|
|
|
2022-11-30 09:52:28 +01:00
|
|
|
|
#endif
|
2020-06-27 21:19:49 -07:00
|
|
|
|
|
2024-08-02 18:20:44 -07:00
|
|
|
|
// If we have a battery at all and it is less than 0%, force deep sleep if we have more than 10 low readings in
|
|
|
|
|
|
// a row. NOTE: min LiIon/LiPo voltage is 2.0 to 2.5V, current OCV min is set to 3100 that is large enough.
|
|
|
|
|
|
//
|
2025-03-29 01:55:00 +01:00
|
|
|
|
|
2024-08-02 18:20:44 -07:00
|
|
|
|
if (batteryLevel && powerStatus2.getHasBattery() && !powerStatus2.getHasUSB()) {
|
|
|
|
|
|
if (batteryLevel->getBattVoltage() < OCV[NUM_OCV_POINTS - 1]) {
|
|
|
|
|
|
low_voltage_counter++;
|
2024-10-14 06:11:43 +02:00
|
|
|
|
LOG_DEBUG("Low voltage counter: %d/10", low_voltage_counter);
|
2024-08-02 18:20:44 -07:00
|
|
|
|
if (low_voltage_counter > 10) {
|
2023-04-22 00:22:09 +02:00
|
|
|
|
#ifdef ARCH_NRF52
|
2024-08-02 18:20:44 -07:00
|
|
|
|
// We can't trigger deep sleep on NRF52, it's freezing the board
|
2024-11-04 19:15:59 -06:00
|
|
|
|
LOG_DEBUG("Low voltage detected, but not trigger deep sleep");
|
2023-04-22 00:22:09 +02:00
|
|
|
|
#else
|
2024-11-04 19:15:59 -06:00
|
|
|
|
LOG_INFO("Low voltage detected, trigger deep sleep");
|
2024-08-02 18:20:44 -07:00
|
|
|
|
powerFSM.trigger(EVENT_LOW_BATTERY);
|
2023-04-22 00:22:09 +02:00
|
|
|
|
#endif
|
2021-09-19 15:03:37 +02:00
|
|
|
|
}
|
2024-08-02 18:20:44 -07:00
|
|
|
|
} else {
|
|
|
|
|
|
low_voltage_counter = 0;
|
2021-09-19 15:03:37 +02:00
|
|
|
|
}
|
2020-08-12 17:03:36 -07:00
|
|
|
|
}
|
2020-06-27 21:19:49 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-10-10 09:57:57 +08:00
|
|
|
|
int32_t Power::runOnce()
|
2020-06-27 21:19:49 -07:00
|
|
|
|
{
|
|
|
|
|
|
readPowerStatus();
|
2020-08-12 17:03:36 -07:00
|
|
|
|
|
2022-09-08 10:36:53 +08:00
|
|
|
|
#ifdef HAS_PMU
|
2020-10-12 09:27:07 +08:00
|
|
|
|
// WE no longer use the IRQ line to wake the CPU (due to false wakes from sleep), but we do poll
|
|
|
|
|
|
// the IRQ status by reading the registers over I2C
|
2023-01-21 14:34:29 +01:00
|
|
|
|
if (PMU) {
|
2020-10-09 14:16:51 +08:00
|
|
|
|
|
2022-09-06 15:58:33 +08:00
|
|
|
|
PMU->getIrqStatus();
|
2020-10-09 14:16:51 +08:00
|
|
|
|
|
2023-01-21 14:34:29 +01:00
|
|
|
|
if (PMU->isVbusRemoveIrq()) {
|
2024-10-14 06:11:43 +02:00
|
|
|
|
LOG_INFO("USB unplugged");
|
2022-09-06 15:58:33 +08:00
|
|
|
|
powerFSM.trigger(EVENT_POWER_DISCONNECTED);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (PMU->isVbusInsertIrq()) {
|
2024-10-14 06:11:43 +02:00
|
|
|
|
LOG_INFO("USB plugged In");
|
2022-09-06 15:58:33 +08:00
|
|
|
|
powerFSM.trigger(EVENT_POWER_CONNECTED);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
Other things we could check if we cared...
|
|
|
|
|
|
|
|
|
|
|
|
if (PMU->isBatChagerStartIrq()) {
|
2024-10-14 06:11:43 +02:00
|
|
|
|
LOG_DEBUG("Battery start charging");
|
2022-09-06 15:58:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (PMU->isBatChagerDoneIrq()) {
|
2024-10-14 06:11:43 +02:00
|
|
|
|
LOG_DEBUG("Battery fully charged");
|
2022-09-06 15:58:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (PMU->isBatInsertIrq()) {
|
2024-10-14 06:11:43 +02:00
|
|
|
|
LOG_DEBUG("Battery inserted");
|
2022-09-06 15:58:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (PMU->isBatRemoveIrq()) {
|
2024-10-14 06:11:43 +02:00
|
|
|
|
LOG_DEBUG("Battery removed");
|
2022-09-06 15:58:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
*/
|
2023-07-22 09:26:54 -05:00
|
|
|
|
#ifndef T_WATCH_S3 // FIXME - why is this triggering on the T-Watch S3?
|
2022-10-30 20:40:30 -05:00
|
|
|
|
if (PMU->isPekeyLongPressIrq()) {
|
2024-10-14 06:11:43 +02:00
|
|
|
|
LOG_DEBUG("PEK long button press");
|
Unify the native display config between legacy display and MUI (#6838)
* Add missed include
* Another Warning fix
* Add another HAS_SCREEN
* Namespace fixes
* Removed depricated destination types and re-factored destination screen
* Get rid of Arduino Strings
* Clean up after Copilot
* SixthLine Def, Screen Rename
Added Sixth Line Definition Screen Rename, and Automatic Line Adjustment
* Consistency is hard - fixed "Sixth"
* System Frame Updates
Adjusted line construction to ensure we fit maximum content per screen.
* Fix up notifications
* Add a couple more ifdef HAS_SCREEN lines
* Add screen->isOverlayBannerShowing()
* Don't forget the invert!
* Adjust Nodelist Center Divider
Adjust Nodelist Center Divider
* Fix variable casting
* Fix entryText variable as empty before update to fix validation
* Altitude is int32_t
* Update PowerTelemetry to have correct data type
* Fix cppcheck warnings (#6945)
* Fix cppcheck warnings
* Adjust logic in Power.cpp for power sensor
---------
Co-authored-by: Jason P <applewiz@mac.com>
* More pixel wrangling so things line up NodeList edition
* Adjust NodeList alignments and plumb some background padding for a possible title fix
* Better alignment for banner notifications
* Move title into drawCommonHeader; initial screen tested
* Fonts make spacing items difficult
* Improved beeping booping and other buzzer based feedback (#6947)
* Improved beeping booping and other buzzer based feedback
* audible button feedback (#6949)
* Refactor
---------
Co-authored-by: todd-herbert <herbert.todd@gmail.com>
* Sandpapered the corners of the notification popup
* Finalize drawCommonHeader migration
* Update Title of Favorite Node Screens
* Update node metric alignment on LoRa screen
* Update the border for popups to separate it from background
* Update PaxcounterModule.cpp with CommonHeader
* Update WiFi screen with CommonHeader and related data reflow
* It was not, in fact, pointing up
* Fix build on wismeshtap
* T-deck trackball debounce
* Fix uptime on Device Focused page to actually detail
* Update Sys screen for new uptime, add label to Freq/Chan on LoRa
* Don't display DOP any longer, make Uptime consistent
* Revert Uptime change on Favorites, Apply to Device Focused
* Label the satelite number to avoid confusion
* Boop boop boop boop
* Correct GPS positioning and string consistency across strings for GPS
* Fix GPS text alignment
* Enable canned messages by default
* Don't wake screen on new nodes
* Cannedmessage list emote support added
* Fn+e emote picker for freetext screen
* Actually block CannedInput actions while display is shown
* Add selection menu to bannerOverlay
* Off by one
* Move to unified text layouts and spacing
* Still my Fav without an "e"
* Fully remove EVENT_NODEDB_UPDATED
* Simply LoRa screen
* Make some char pointers const to fix compilation on native targets
* Update drawCompassNorth to include radius
* Fix warning
* button thread cleanup
* Pull OneButton handling from PowerFSM and add MUI switch (#6973)
* Trunk
* Onebutton Menu Support
* Add temporary clock icon
* Add gps location to fsi
* Banner message state reset
* Cast to char to satisfy compiler
* Better fast handling of input during banner
* Fix warning
* Derp
* oops
* Update ref
* Wire buzzer_mode
* remove legacy string->print()
* Only init screen if one found
* Unsigned Char
* More buttonThread cleaning
* screen.cpp button handling cleanup
* The Great Event Rename of 2025
* Fix the Radiomaster
* Missed trackball type change
* Remove unused function
* Make ButtonThread an InputBroker
* Coffee hadn't kicked in yet
* Add clock icon for Navigation Bar
* Restore clock screen definition code - whoops
* ExternalNotifications now observe inputBroker
* Clock rework (#6992)
* Move Clock bits into ClockRenderer space
* Rework clock into all device navigation
* T-Watch Actually Builds Different
* Compile fix
---------
Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz>
* Add AM/PM to Digital Clock
* Flip Seconds and AM/PM on Clock Display
* Tik-tok pixels are hard
* Fix builds on Thinknode M1
* Check for GPS and don't crash
* Don't endif til the end
* Rework the OneButton thread to be much less of a mess. (#6997)
* Rework the OneButton thread to be much less of a mess. And break lots of targets temporarily
* Update src/input/ButtonThread.h
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* fix GPS toggle
* Send the shutdown event, not just the kbchar
* Honor the back button in a notificaiton popup
* Draw the right size box for popup with options
* Try to un-break all the things
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* 24-hour Clock Should have leading zero, but not 12-hour
* Fixup some compile errors
* Add intRoutine to ButtonThread init, to get more responsive user button back
* Add Timezone picker
* Fix Warning
* Optionally set the initial selection for the chooser popup
* Make back buttons work in canned messages
* Drop the wrapper classes
* LonPressTime now configurable
* Clock Frame can not longer be blank; just add valid time
* Back buttons everywhere!
* Key Verification confirm banner
* Make Elecrow M* top button a back button
* Add settings saves
* EInk responsiveness fixes
* Linux Input Fixes
* Add Native Trackball/Joystick support, and move UserButton to Input
* No Flight Stick Mode
* Send input event
* Add Channel Utilization to Device Focused frame
* Don't shift screens when we draw new ones
* Add showOverlayBanner arguments to no-op
* trunk
* Default Native trackball to NC
* Fix crash in simulator mode
* Add longLong button press
* Get the args right
* Adjust Bluetooth Pairing Screen to account for bottom navigation.
* Trackball everywhere, and unPhone buttons
* Remap visionmaster secondary button to TB_UP
* Kill ScanAndSelect
* trunk
* No longer need the canned messages input filter
* All Canned All the time
* Fix stm32 compile error regarding inputBroker
* Unify tft lineheights (#7033)
* Create variable line heights based upon SCREEN_HEIGHT
* Refactor textPositions into method -> getTextPositions
* Update SharedUIDisplay.h
---------
Co-authored-by: Jason P <applewiz@mac.com>
* Adjust top distance for larger displays
* Adjust icon sizes for larger displays
* Fix Paxcounter compile errors after code updates
* Pixel wrangling to make larger screens fit better
* Alert frame has precedence over banner -- for now
* Unify on ALT_BUTTON
* Align AM/PM to the digit, not the segment on larger displays
* Move some global pin defines into configuration.h
* Scaffolding for BMM150 9-axis gyro
* Alt button behavior
* Don't add the blank GPS frames without HAS_GPS
* EVENT_NODEDB_UPDATED has been retired
* Clean out LOG_WARN messages from debugging
* Add dismiss message function
* Minor buttonThread cleanup
* Add BMM150 support
* Clean up last warning from dev
* Simplify bmm150 init return logic
* Add option to reply to messages
* Add minimal menu upon selecting home screen
* Move Messages to slot 2, rename GPS to Position, move variables nearer functional usage in Screen.cpp
* Properly dismiss message
* T-Deck Trackball press is not user button
* Add select on favorite frame to launch cannedMessage DM
* Minor wording change
* Less capital letters
* Fix empty message check, time isn't reliable
* drop dead code
* Make UIRenderer a static class instead of namespace
* Fix the select on favorite
* Check if message is empty early and then 'return'
* Add kb_found, and show the option to launch freetype if appropriate
* Ignore impossible touchscreen touches
* Auto scroll fix
* Move linebreak after "from" for banners to maximize screen usage.
* Center "No messages to show" on Message frame
* Start consolidating buzzer behavior
* Fixed signed / unsigned warning
* Cast second parameter of max() to make some targets happy
* Cast kbchar to (char) to make arduino string happy
* Shorten the notice of "No messages"
* Add buzzer mode chooser
* Add regionPicker to Lora icon
* Reduce line spacing and reorder Position screen to resolve overlapping issues
* Update message titles, fix GPS icons, add Back options
* Leftover boops
* Remove chirp
* Make the region selection dismissable when a region is already set
* Add read-aloud functionality on messages w/ esp8266sam
* "Last Heard" is a better label
* tweak the beep
* 5 options
* properly tear down freetext upon cancel
* de-convelute canned messages just a bit
* Correct height of Mail icon in navigation bar
* Remove unused warning
* Consolidate time methods into TimeFormatters
* Oops
* Change LoRa Picker Cancel to Back
* Tweak selection characters on Banner
* Message render not scrolling on 5th line
* More fixes for message scrolling
* Remove the safety next on text overflow - we found that root cause
* Add pin definitions to fix compilation for obscure target
* Don't let the touchscreen send unitialized kbchar values
* Make virtual KB just a bit quicker
* No more double tap, swipe!
* Left is left, and Right is right
* Update horizontal lightning bolt design
* Move from solid to dashed separator for Message Frame
* Single emote feature fix
* Manually sort overlapping elements for now
* Freetext and clearer choices
* Fix ESP32 InkHUD builds on the unify-tft branch (#7087)
* Remove BaseUI branding
* Capitalization is fun
* Revert Meshtastic Boot Frame Changes
* Add ANZ_433 LoRa region to picker
* Update settings.json
---------
Co-authored-by: HarukiToreda <116696711+HarukiToreda@users.noreply.github.com>
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Jason P <applewiz@mac.com>
Co-authored-by: todd-herbert <herbert.todd@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-21 06:36:04 -05:00
|
|
|
|
if (screen)
|
|
|
|
|
|
screen->setOn(false);
|
2022-10-30 20:40:30 -05:00
|
|
|
|
}
|
2023-07-22 09:26:54 -05:00
|
|
|
|
#endif
|
2022-09-06 15:58:33 +08:00
|
|
|
|
|
|
|
|
|
|
PMU->clearIrqStatus();
|
2020-10-12 09:27:07 +08:00
|
|
|
|
}
|
2020-10-12 09:33:15 +08:00
|
|
|
|
#endif
|
2020-06-27 21:19:49 -07:00
|
|
|
|
// Only read once every 20 seconds once the power status for the app has been initialized
|
2020-10-10 09:57:57 +08:00
|
|
|
|
return (statusHandler && statusHandler->isInitialized()) ? (1000 * 20) : RUN_SAME;
|
2020-06-27 21:19:49 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Init the power manager chip
|
|
|
|
|
|
*
|
|
|
|
|
|
* axp192 power
|
2023-05-16 01:40:42 -04:00
|
|
|
|
DCDC1 0.7-3.5V @ 1200mA max -> OLED // If you turn this off you'll lose comms to the axp192 because the OLED and the
|
|
|
|
|
|
axp192 share the same i2c bus, instead use ssd1306 sleep mode DCDC2 -> unused DCDC3 0.7-3.5V @ 700mA max -> ESP32 (keep this
|
|
|
|
|
|
on!) LDO1 30mA -> charges GPS backup battery // charges the tiny J13 battery by the GPS to power the GPS ram (for a couple of
|
|
|
|
|
|
days), can not be turned off LDO2 200mA -> LORA LDO3 200mA -> GPS
|
2023-01-21 14:34:29 +01:00
|
|
|
|
*
|
2020-06-27 21:19:49 -07:00
|
|
|
|
*/
|
2022-09-06 15:58:33 +08:00
|
|
|
|
bool Power::axpChipInit()
|
2020-06-27 21:19:49 -07:00
|
|
|
|
{
|
2021-01-16 23:10:08 -08:00
|
|
|
|
|
2022-09-08 10:36:53 +08:00
|
|
|
|
#ifdef HAS_PMU
|
2020-06-27 21:19:49 -07:00
|
|
|
|
|
2023-01-21 14:34:29 +01:00
|
|
|
|
TwoWire *w = NULL;
|
2022-10-07 19:57:55 +08:00
|
|
|
|
|
|
|
|
|
|
// Use macro to distinguish which wire is used by PMU
|
|
|
|
|
|
#ifdef PMU_USE_WIRE1
|
2023-01-21 14:34:29 +01:00
|
|
|
|
w = &Wire1;
|
2022-10-07 19:57:55 +08:00
|
|
|
|
#else
|
2023-01-21 14:34:29 +01:00
|
|
|
|
w = &Wire;
|
2022-10-07 19:57:55 +08:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2023-01-21 14:34:29 +01:00
|
|
|
|
* It is not necessary to specify the wire pin,
|
2022-10-07 19:57:55 +08:00
|
|
|
|
* just input the wire, because the wire has been initialized in main.cpp
|
|
|
|
|
|
*/
|
2022-09-06 15:58:33 +08:00
|
|
|
|
if (!PMU) {
|
2022-10-07 19:57:55 +08:00
|
|
|
|
PMU = new XPowersAXP2101(*w);
|
2022-09-06 15:58:33 +08:00
|
|
|
|
if (!PMU->init()) {
|
2024-11-04 12:16:25 -06:00
|
|
|
|
LOG_WARN("No AXP2101 power management");
|
2022-09-06 15:58:33 +08:00
|
|
|
|
delete PMU;
|
|
|
|
|
|
PMU = NULL;
|
|
|
|
|
|
} else {
|
2024-11-04 19:15:59 -06:00
|
|
|
|
LOG_INFO("AXP2101 PMU init succeeded");
|
2022-09-06 15:58:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-06-27 21:19:49 -07:00
|
|
|
|
|
2022-09-06 15:58:33 +08:00
|
|
|
|
if (!PMU) {
|
2022-10-07 19:57:55 +08:00
|
|
|
|
PMU = new XPowersAXP192(*w);
|
2022-09-06 15:58:33 +08:00
|
|
|
|
if (!PMU->init()) {
|
2024-11-04 12:16:25 -06:00
|
|
|
|
LOG_WARN("No AXP192 power management");
|
2022-09-06 15:58:33 +08:00
|
|
|
|
delete PMU;
|
|
|
|
|
|
PMU = NULL;
|
2020-06-27 21:19:49 -07:00
|
|
|
|
} else {
|
2024-11-04 19:15:59 -06:00
|
|
|
|
LOG_INFO("AXP192 PMU init succeeded");
|
2020-06-27 21:19:49 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-08-12 17:03:36 -07:00
|
|
|
|
|
2022-09-06 15:58:33 +08:00
|
|
|
|
if (!PMU) {
|
2023-01-21 14:34:29 +01:00
|
|
|
|
/*
|
|
|
|
|
|
* In XPowersLib, if the XPowersAXPxxx object is released, Wire.end() will be called at the same time.
|
|
|
|
|
|
* In order not to affect other devices, if the initialization of the PMU fails, Wire needs to be re-initialized once,
|
|
|
|
|
|
* if there are multiple devices sharing the bus.
|
|
|
|
|
|
* * */
|
2022-10-07 19:57:55 +08:00
|
|
|
|
#ifndef PMU_USE_WIRE1
|
|
|
|
|
|
w->begin(I2C_SDA, I2C_SCL);
|
|
|
|
|
|
#endif
|
2022-09-06 15:58:33 +08:00
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
batteryLevel = PMU;
|
|
|
|
|
|
|
|
|
|
|
|
if (PMU->getChipModel() == XPOWERS_AXP192) {
|
2023-01-21 14:34:29 +01:00
|
|
|
|
|
2022-09-06 15:58:33 +08:00
|
|
|
|
// lora radio power channel
|
|
|
|
|
|
PMU->setPowerChannelVoltage(XPOWERS_LDO2, 3300);
|
|
|
|
|
|
PMU->enablePowerOutput(XPOWERS_LDO2);
|
|
|
|
|
|
|
|
|
|
|
|
// oled module power channel,
|
2023-01-21 14:34:29 +01:00
|
|
|
|
// disable it will cause abnormal communication between boot and AXP power supply,
|
2022-09-06 15:58:33 +08:00
|
|
|
|
// do not turn it off
|
|
|
|
|
|
PMU->setPowerChannelVoltage(XPOWERS_DCDC1, 3300);
|
|
|
|
|
|
// enable oled power
|
|
|
|
|
|
PMU->enablePowerOutput(XPOWERS_DCDC1);
|
|
|
|
|
|
|
|
|
|
|
|
// gnss module power channel - now turned on in setGpsPower
|
|
|
|
|
|
PMU->setPowerChannelVoltage(XPOWERS_LDO3, 3300);
|
|
|
|
|
|
// PMU->enablePowerOutput(XPOWERS_LDO3);
|
|
|
|
|
|
|
2023-01-21 14:34:29 +01:00
|
|
|
|
// protected oled power source
|
2022-09-06 15:58:33 +08:00
|
|
|
|
PMU->setProtectedChannel(XPOWERS_DCDC1);
|
2023-01-21 14:34:29 +01:00
|
|
|
|
// protected esp32 power source
|
2022-09-06 15:58:33 +08:00
|
|
|
|
PMU->setProtectedChannel(XPOWERS_DCDC3);
|
|
|
|
|
|
|
2023-01-21 14:34:29 +01:00
|
|
|
|
// disable not use channel
|
2022-09-06 15:58:33 +08:00
|
|
|
|
PMU->disablePowerOutput(XPOWERS_DCDC2);
|
|
|
|
|
|
|
2023-01-21 14:34:29 +01:00
|
|
|
|
// disable all axp chip interrupt
|
2022-09-06 15:58:33 +08:00
|
|
|
|
PMU->disableIRQ(XPOWERS_AXP192_ALL_IRQ);
|
|
|
|
|
|
|
|
|
|
|
|
// Set constant current charging current
|
2022-09-09 21:49:54 +02:00
|
|
|
|
PMU->setChargerConstantCurr(XPOWERS_AXP192_CHG_CUR_450MA);
|
2022-09-06 15:58:33 +08:00
|
|
|
|
|
2023-01-21 14:34:29 +01:00
|
|
|
|
// Set up the charging voltage
|
2022-12-06 16:56:38 +01:00
|
|
|
|
PMU->setChargeTargetVoltage(XPOWERS_AXP192_CHG_VOL_4V2);
|
2022-09-06 15:58:33 +08:00
|
|
|
|
} else if (PMU->getChipModel() == XPOWERS_AXP2101) {
|
|
|
|
|
|
|
2023-03-27 10:50:17 +02:00
|
|
|
|
/*The alternative version of T-Beam 1.1 differs from T-Beam V1.1 in that it uses an AXP2101 power chip*/
|
2023-05-27 10:03:02 +02:00
|
|
|
|
if (HW_VENDOR == meshtastic_HardwareModel_TBEAM) {
|
2023-05-27 10:17:37 +08:00
|
|
|
|
// Unuse power channel
|
|
|
|
|
|
PMU->disablePowerOutput(XPOWERS_DCDC2);
|
|
|
|
|
|
PMU->disablePowerOutput(XPOWERS_DCDC3);
|
|
|
|
|
|
PMU->disablePowerOutput(XPOWERS_DCDC4);
|
|
|
|
|
|
PMU->disablePowerOutput(XPOWERS_DCDC5);
|
|
|
|
|
|
PMU->disablePowerOutput(XPOWERS_ALDO1);
|
|
|
|
|
|
PMU->disablePowerOutput(XPOWERS_ALDO4);
|
|
|
|
|
|
PMU->disablePowerOutput(XPOWERS_BLDO1);
|
|
|
|
|
|
PMU->disablePowerOutput(XPOWERS_BLDO2);
|
|
|
|
|
|
PMU->disablePowerOutput(XPOWERS_DLDO1);
|
|
|
|
|
|
PMU->disablePowerOutput(XPOWERS_DLDO2);
|
|
|
|
|
|
|
|
|
|
|
|
// GNSS RTC PowerVDD 3300mV
|
|
|
|
|
|
PMU->setPowerChannelVoltage(XPOWERS_VBACKUP, 3300);
|
|
|
|
|
|
PMU->enablePowerOutput(XPOWERS_VBACKUP);
|
|
|
|
|
|
|
|
|
|
|
|
// ESP32 VDD 3300mV
|
|
|
|
|
|
// ! No need to set, automatically open , Don't close it
|
|
|
|
|
|
// PMU->setPowerChannelVoltage(XPOWERS_DCDC1, 3300);
|
|
|
|
|
|
// PMU->setProtectedChannel(XPOWERS_DCDC1);
|
|
|
|
|
|
|
|
|
|
|
|
// LoRa VDD 3300mV
|
|
|
|
|
|
PMU->setPowerChannelVoltage(XPOWERS_ALDO2, 3300);
|
|
|
|
|
|
PMU->enablePowerOutput(XPOWERS_ALDO2);
|
|
|
|
|
|
|
|
|
|
|
|
// GNSS VDD 3300mV
|
|
|
|
|
|
PMU->setPowerChannelVoltage(XPOWERS_ALDO3, 3300);
|
|
|
|
|
|
PMU->enablePowerOutput(XPOWERS_ALDO3);
|
2023-07-22 09:26:54 -05:00
|
|
|
|
} else if (HW_VENDOR == meshtastic_HardwareModel_LILYGO_TBEAM_S3_CORE ||
|
|
|
|
|
|
HW_VENDOR == meshtastic_HardwareModel_T_WATCH_S3) {
|
2023-05-27 10:17:37 +08:00
|
|
|
|
// t-beam s3 core
|
|
|
|
|
|
/**
|
|
|
|
|
|
* gnss module power channel
|
|
|
|
|
|
* The default ALDO4 is off, you need to turn on the GNSS power first, otherwise it will be invalid during
|
|
|
|
|
|
* initialization
|
|
|
|
|
|
*/
|
|
|
|
|
|
PMU->setPowerChannelVoltage(XPOWERS_ALDO4, 3300);
|
|
|
|
|
|
PMU->enablePowerOutput(XPOWERS_ALDO4);
|
|
|
|
|
|
|
|
|
|
|
|
// lora radio power channel
|
|
|
|
|
|
PMU->setPowerChannelVoltage(XPOWERS_ALDO3, 3300);
|
|
|
|
|
|
PMU->enablePowerOutput(XPOWERS_ALDO3);
|
|
|
|
|
|
|
|
|
|
|
|
// m.2 interface
|
|
|
|
|
|
PMU->setPowerChannelVoltage(XPOWERS_DCDC3, 3300);
|
|
|
|
|
|
PMU->enablePowerOutput(XPOWERS_DCDC3);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* ALDO2 cannot be turned off.
|
|
|
|
|
|
* It is a necessary condition for sensor communication.
|
|
|
|
|
|
* It must be turned on to properly access the sensor and screen
|
|
|
|
|
|
* It is also responsible for the power supply of PCF8563
|
|
|
|
|
|
*/
|
|
|
|
|
|
PMU->setPowerChannelVoltage(XPOWERS_ALDO2, 3300);
|
|
|
|
|
|
PMU->enablePowerOutput(XPOWERS_ALDO2);
|
|
|
|
|
|
|
|
|
|
|
|
// 6-axis , magnetometer ,bme280 , oled screen power channel
|
|
|
|
|
|
PMU->setPowerChannelVoltage(XPOWERS_ALDO1, 3300);
|
|
|
|
|
|
PMU->enablePowerOutput(XPOWERS_ALDO1);
|
|
|
|
|
|
|
2023-07-14 17:25:20 -04:00
|
|
|
|
// sdcard power channel
|
2023-05-27 10:17:37 +08:00
|
|
|
|
PMU->setPowerChannelVoltage(XPOWERS_BLDO1, 3300);
|
|
|
|
|
|
PMU->enablePowerOutput(XPOWERS_BLDO1);
|
|
|
|
|
|
|
2023-07-22 09:26:54 -05:00
|
|
|
|
#ifdef T_WATCH_S3
|
|
|
|
|
|
// DRV2605 power channel
|
|
|
|
|
|
PMU->setPowerChannelVoltage(XPOWERS_BLDO2, 3300);
|
|
|
|
|
|
PMU->enablePowerOutput(XPOWERS_BLDO2);
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2023-05-27 10:17:37 +08:00
|
|
|
|
// PMU->setPowerChannelVoltage(XPOWERS_DCDC4, 3300);
|
|
|
|
|
|
// PMU->enablePowerOutput(XPOWERS_DCDC4);
|
|
|
|
|
|
|
|
|
|
|
|
// not use channel
|
|
|
|
|
|
PMU->disablePowerOutput(XPOWERS_DCDC2); // not elicited
|
|
|
|
|
|
PMU->disablePowerOutput(XPOWERS_DCDC5); // not elicited
|
|
|
|
|
|
PMU->disablePowerOutput(XPOWERS_DLDO1); // Invalid power channel, it does not exist
|
|
|
|
|
|
PMU->disablePowerOutput(XPOWERS_DLDO2); // Invalid power channel, it does not exist
|
|
|
|
|
|
PMU->disablePowerOutput(XPOWERS_VBACKUP);
|
|
|
|
|
|
}
|
2023-03-27 10:33:26 +08:00
|
|
|
|
|
2023-01-21 14:34:29 +01:00
|
|
|
|
// disable all axp chip interrupt
|
2022-09-06 15:58:33 +08:00
|
|
|
|
PMU->disableIRQ(XPOWERS_AXP2101_ALL_IRQ);
|
|
|
|
|
|
|
2023-01-21 14:34:29 +01:00
|
|
|
|
// Set the constant current charging current of AXP2101, temporarily use 500mA by default
|
2022-09-06 15:58:33 +08:00
|
|
|
|
PMU->setChargerConstantCurr(XPOWERS_AXP2101_CHG_CUR_500MA);
|
|
|
|
|
|
|
2023-01-21 14:34:29 +01:00
|
|
|
|
// Set up the charging voltage
|
2022-12-06 16:56:38 +01:00
|
|
|
|
PMU->setChargeTargetVoltage(XPOWERS_AXP2101_CHG_VOL_4V2);
|
2022-09-06 15:58:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PMU->clearIrqStatus();
|
|
|
|
|
|
|
2023-01-21 14:34:29 +01:00
|
|
|
|
// TBeam1.1 /T-Beam S3-Core has no external TS detection,
|
2022-09-06 15:58:33 +08:00
|
|
|
|
// it needs to be disabled, otherwise it will cause abnormal charging
|
|
|
|
|
|
PMU->disableTSPinMeasure();
|
|
|
|
|
|
|
|
|
|
|
|
// PMU->enableSystemVoltageMeasure();
|
|
|
|
|
|
PMU->enableVbusVoltageMeasure();
|
|
|
|
|
|
PMU->enableBattVoltageMeasure();
|
|
|
|
|
|
|
|
|
|
|
|
if (PMU->isChannelAvailable(XPOWERS_DCDC1)) {
|
2024-10-14 06:11:43 +02:00
|
|
|
|
LOG_DEBUG("DC1 : %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_DCDC1) ? "+" : "-",
|
2023-01-21 14:34:29 +01:00
|
|
|
|
PMU->getPowerChannelVoltage(XPOWERS_DCDC1));
|
2022-09-06 15:58:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (PMU->isChannelAvailable(XPOWERS_DCDC2)) {
|
2024-10-14 06:11:43 +02:00
|
|
|
|
LOG_DEBUG("DC2 : %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_DCDC2) ? "+" : "-",
|
2023-01-21 14:34:29 +01:00
|
|
|
|
PMU->getPowerChannelVoltage(XPOWERS_DCDC2));
|
2022-09-06 15:58:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (PMU->isChannelAvailable(XPOWERS_DCDC3)) {
|
2024-10-14 06:11:43 +02:00
|
|
|
|
LOG_DEBUG("DC3 : %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_DCDC3) ? "+" : "-",
|
2023-01-21 14:34:29 +01:00
|
|
|
|
PMU->getPowerChannelVoltage(XPOWERS_DCDC3));
|
2022-09-06 15:58:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (PMU->isChannelAvailable(XPOWERS_DCDC4)) {
|
2024-10-14 06:11:43 +02:00
|
|
|
|
LOG_DEBUG("DC4 : %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_DCDC4) ? "+" : "-",
|
2023-01-21 14:34:29 +01:00
|
|
|
|
PMU->getPowerChannelVoltage(XPOWERS_DCDC4));
|
2022-09-06 15:58:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (PMU->isChannelAvailable(XPOWERS_LDO2)) {
|
2024-10-14 06:11:43 +02:00
|
|
|
|
LOG_DEBUG("LDO2 : %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_LDO2) ? "+" : "-",
|
2023-01-21 14:34:29 +01:00
|
|
|
|
PMU->getPowerChannelVoltage(XPOWERS_LDO2));
|
2022-09-06 15:58:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (PMU->isChannelAvailable(XPOWERS_LDO3)) {
|
2024-10-14 06:11:43 +02:00
|
|
|
|
LOG_DEBUG("LDO3 : %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_LDO3) ? "+" : "-",
|
2023-01-21 14:34:29 +01:00
|
|
|
|
PMU->getPowerChannelVoltage(XPOWERS_LDO3));
|
2022-09-06 15:58:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (PMU->isChannelAvailable(XPOWERS_ALDO1)) {
|
2024-10-14 06:11:43 +02:00
|
|
|
|
LOG_DEBUG("ALDO1: %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_ALDO1) ? "+" : "-",
|
2023-01-21 14:34:29 +01:00
|
|
|
|
PMU->getPowerChannelVoltage(XPOWERS_ALDO1));
|
2022-09-06 15:58:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (PMU->isChannelAvailable(XPOWERS_ALDO2)) {
|
2024-10-14 06:11:43 +02:00
|
|
|
|
LOG_DEBUG("ALDO2: %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_ALDO2) ? "+" : "-",
|
2023-01-21 14:34:29 +01:00
|
|
|
|
PMU->getPowerChannelVoltage(XPOWERS_ALDO2));
|
2022-09-06 15:58:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (PMU->isChannelAvailable(XPOWERS_ALDO3)) {
|
2024-10-14 06:11:43 +02:00
|
|
|
|
LOG_DEBUG("ALDO3: %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_ALDO3) ? "+" : "-",
|
2023-01-21 14:34:29 +01:00
|
|
|
|
PMU->getPowerChannelVoltage(XPOWERS_ALDO3));
|
2022-09-06 15:58:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (PMU->isChannelAvailable(XPOWERS_ALDO4)) {
|
2024-10-14 06:11:43 +02:00
|
|
|
|
LOG_DEBUG("ALDO4: %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_ALDO4) ? "+" : "-",
|
2023-01-21 14:34:29 +01:00
|
|
|
|
PMU->getPowerChannelVoltage(XPOWERS_ALDO4));
|
2022-09-06 15:58:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (PMU->isChannelAvailable(XPOWERS_BLDO1)) {
|
2024-10-14 06:11:43 +02:00
|
|
|
|
LOG_DEBUG("BLDO1: %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_BLDO1) ? "+" : "-",
|
2023-01-21 14:34:29 +01:00
|
|
|
|
PMU->getPowerChannelVoltage(XPOWERS_BLDO1));
|
2022-09-06 15:58:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (PMU->isChannelAvailable(XPOWERS_BLDO2)) {
|
2024-10-14 06:11:43 +02:00
|
|
|
|
LOG_DEBUG("BLDO2: %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_BLDO2) ? "+" : "-",
|
2023-01-21 14:34:29 +01:00
|
|
|
|
PMU->getPowerChannelVoltage(XPOWERS_BLDO2));
|
2022-09-06 15:58:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-12-14 17:26:55 +01:00
|
|
|
|
// We can safely ignore this approach for most (or all) boards because MCU turned off
|
|
|
|
|
|
// earlier than battery discharged to 2.6V.
|
|
|
|
|
|
//
|
|
|
|
|
|
// Unfortanly for now we can't use this killswitch for RAK4630-based boards because they have a bug with
|
|
|
|
|
|
// battery voltage measurement. Probably it sometimes drops to low values.
|
|
|
|
|
|
#ifndef RAK4630
|
2022-09-06 15:58:33 +08:00
|
|
|
|
// Set PMU shutdown voltage at 2.6V to maximize battery utilization
|
|
|
|
|
|
PMU->setSysPowerDownVoltage(2600);
|
2022-12-14 14:36:15 +01:00
|
|
|
|
#endif
|
2022-09-06 15:58:33 +08:00
|
|
|
|
|
|
|
|
|
|
#ifdef PMU_IRQ
|
2023-01-21 14:34:29 +01:00
|
|
|
|
uint64_t pmuIrqMask = 0;
|
2022-09-06 15:58:33 +08:00
|
|
|
|
|
2023-01-21 14:34:29 +01:00
|
|
|
|
if (PMU->getChipModel() == XPOWERS_AXP192) {
|
|
|
|
|
|
pmuIrqMask = XPOWERS_AXP192_VBUS_INSERT_IRQ | XPOWERS_AXP192_BAT_INSERT_IRQ | XPOWERS_AXP192_PKEY_SHORT_IRQ;
|
|
|
|
|
|
} else if (PMU->getChipModel() == XPOWERS_AXP2101) {
|
|
|
|
|
|
pmuIrqMask = XPOWERS_AXP2101_VBUS_INSERT_IRQ | XPOWERS_AXP2101_BAT_INSERT_IRQ | XPOWERS_AXP2101_PKEY_SHORT_IRQ;
|
|
|
|
|
|
}
|
2022-09-06 15:58:33 +08:00
|
|
|
|
|
2023-01-21 14:34:29 +01:00
|
|
|
|
pinMode(PMU_IRQ, INPUT);
|
|
|
|
|
|
attachInterrupt(
|
|
|
|
|
|
PMU_IRQ, [] { pmu_irq = true; }, FALLING);
|
2022-09-06 15:58:33 +08:00
|
|
|
|
|
2023-01-21 14:34:29 +01:00
|
|
|
|
// we do not look for AXPXXX_CHARGING_FINISHED_IRQ & AXPXXX_CHARGING_IRQ because it occurs repeatedly while there is
|
|
|
|
|
|
// no battery also it could cause inadvertent waking from light sleep just because the battery filled
|
|
|
|
|
|
// we don't look for AXPXXX_BATT_REMOVED_IRQ because it occurs repeatedly while no battery installed
|
|
|
|
|
|
// we don't look at AXPXXX_VBUS_REMOVED_IRQ because we don't have anything hooked to vbus
|
|
|
|
|
|
PMU->enableIRQ(pmuIrqMask);
|
2022-09-06 15:58:33 +08:00
|
|
|
|
|
2023-01-21 14:34:29 +01:00
|
|
|
|
PMU->clearIrqStatus();
|
2022-09-06 15:58:33 +08:00
|
|
|
|
#endif /*PMU_IRQ*/
|
|
|
|
|
|
|
2023-01-21 14:34:29 +01:00
|
|
|
|
readPowerStatus();
|
2022-09-06 15:58:33 +08:00
|
|
|
|
|
2022-09-08 10:32:12 +08:00
|
|
|
|
pmu_found = true;
|
2022-09-06 15:58:33 +08:00
|
|
|
|
|
2022-09-08 10:32:12 +08:00
|
|
|
|
return pmu_found;
|
2022-09-06 15:58:33 +08:00
|
|
|
|
|
2020-08-12 17:03:36 -07:00
|
|
|
|
#else
|
|
|
|
|
|
return false;
|
2020-06-27 21:19:49 -07:00
|
|
|
|
#endif
|
2024-09-25 20:34:53 +10:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-02 12:01:45 +01:00
|
|
|
|
#if !MESHTASTIC_EXCLUDE_I2C && __has_include(<Adafruit_MAX1704X.h>)
|
2024-09-25 20:34:53 +10:00
|
|
|
|
|
|
|
|
|
|
/**
|
2024-09-27 23:35:57 -05:00
|
|
|
|
* Wrapper class for an I2C MAX17048 Lipo battery sensor.
|
2024-09-25 20:34:53 +10:00
|
|
|
|
*/
|
2024-09-27 23:35:57 -05:00
|
|
|
|
class LipoBatteryLevel : public HasBatteryLevel
|
2024-09-25 20:34:53 +10:00
|
|
|
|
{
|
|
|
|
|
|
private:
|
|
|
|
|
|
MAX17048Singleton *max17048 = nullptr;
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Init the I2C MAX17048 Lipo battery level sensor
|
|
|
|
|
|
*/
|
|
|
|
|
|
bool runOnce()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (max17048 == nullptr) {
|
|
|
|
|
|
max17048 = MAX17048Singleton::GetInstance();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// try to start if the sensor has been detected
|
|
|
|
|
|
if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_MAX17048].first != 0) {
|
|
|
|
|
|
return max17048->runOnce(nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_MAX17048].second);
|
|
|
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Battery state of charge, from 0 to 100 or -1 for unknown
|
|
|
|
|
|
*/
|
2024-09-27 23:35:57 -05:00
|
|
|
|
virtual int getBatteryPercent() override { return max17048->getBusBatteryPercent(); }
|
2024-09-25 20:34:53 +10:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* The raw voltage of the battery in millivolts, or NAN if unknown
|
|
|
|
|
|
*/
|
2024-09-27 23:35:57 -05:00
|
|
|
|
virtual uint16_t getBattVoltage() override { return max17048->getBusVoltageMv(); }
|
2024-09-25 20:34:53 +10:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* return true if there is a battery installed in this unit
|
|
|
|
|
|
*/
|
2024-09-27 23:35:57 -05:00
|
|
|
|
virtual bool isBatteryConnect() override { return max17048->isBatteryConnected(); }
|
2024-09-25 20:34:53 +10:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* return true if there is an external power source detected
|
|
|
|
|
|
*/
|
2024-09-27 23:35:57 -05:00
|
|
|
|
virtual bool isVbusIn() override { return max17048->isExternallyPowered(); }
|
2024-09-25 20:34:53 +10:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* return true if the battery is currently charging
|
|
|
|
|
|
*/
|
2024-09-27 23:35:57 -05:00
|
|
|
|
virtual bool isCharging() override { return max17048->isBatteryCharging(); }
|
2024-09-25 20:34:53 +10:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
LipoBatteryLevel lipoLevel;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Init the Lipo battery level sensor
|
|
|
|
|
|
*/
|
|
|
|
|
|
bool Power::lipoInit()
|
|
|
|
|
|
{
|
|
|
|
|
|
bool result = lipoLevel.runOnce();
|
2024-10-14 06:11:43 +02:00
|
|
|
|
LOG_DEBUG("Power::lipoInit lipo sensor is %s", result ? "ready" : "not ready yet");
|
2024-09-27 23:35:57 -05:00
|
|
|
|
if (!result)
|
|
|
|
|
|
return false;
|
2024-09-25 20:34:53 +10:00
|
|
|
|
batteryLevel = &lipoLevel;
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
/**
|
|
|
|
|
|
* The Lipo battery level sensor is unavailable - default to AnalogBatteryLevel
|
|
|
|
|
|
*/
|
|
|
|
|
|
bool Power::lipoInit()
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
Detect charging status by measuring current flow with configured INA battery sensor (#5271)
* INA219 charging detection
minimal implementation: if there is a configured INA219 sensor for battery monitoring we can take the current flow across the shunt resistor to know if we are charging the battery - negative milliamps indicate charging
* Update Power.cpp
added comments and 2 extra defines to disable and swap detection direction
* Update Power.cpp
fix disabled case
* move getCurrentMa() to new CurrentSensor class
* INA219 charging detection
minimal implementation: if there is a configured INA219 sensor for battery monitoring we can take the current flow across the shunt resistor to know if we are charging the battery - negative milliamps indicate charging
* Update Power.cpp
added comments and 2 extra defines to disable and swap detection direction
* Update Power.cpp
fix disabled case
* move getCurrentMa() to new CurrentSensor class
* add INA3221 charging detection
* RP2040: Update core; add mDNS support (#5355)
* Update arduino-pico core
* RP2040: Add mDNS support
* SimpleMDNS `begin` now returns a bool
* Add `-g` option to `debug_build_flags` to link files for gdb
* RAK11310 needs old platform as well
* Change defines to specific architecture
* Core version 4.2.1 is out
* Add sudo to apt-get commands for Raspbian Build (#5364)
Without sudo, inadequate permissions to runs the commands meant
the build was failing.
* Typo fix in build_raspbian.yml (#5365)
s/sudp/sudo :(:(:(
* Rework some things
* Trunk
* Separate littlefs bundle
* version tags
* Diag
* Add littlefswebui
* Bug fixed in ExternalNotificationModule (#5375)
While `nagging` setExternalState wasn't written to Buzzer & Vibra so output was never toggled.
Possible fix for #5348
* Cleanup static files from bad Web UI bundle on 2.5.13 release (#5376)
* Cleanup static files from bad Web UI bundle on 2.5.13 release
* Check existence first
* Esp32 is the only one we care about
* Move some actions to after `startTransmit()` (#5383)
To minimize the time between channel scan and actual transmit
* [create-pull-request] automated change (#5380)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Allows all 3 PKI keys to be added to userPrefs.h (#4969) and a tool. (#5368)
* more userPrefs.h
Added PKI Admin keys to userPrefs.h
* Update userPrefs.h
Allows all 3 PKI keys to be added to userPrefs.h (#4969)
* Update NodeDB.cpp
Trunk
* Update userPrefs.h
Changed wording
* Create base64_to_hex.py
A little tool for converting base64 PKI Keys to decoded byte that userPrefs.h can understand.
* more userPrefs.h
Added PKI Admin keys to userPrefs.h
* Update userPrefs.h
Allows all 3 PKI keys to be added to userPrefs.h (#4969)
* Update NodeDB.cpp
Trunk
* Update userPrefs.h
Changed wording
* Create base64_to_hex.py
A little tool for converting base64 PKI Keys to decoded byte that userPrefs.h can understand.
* [create-pull-request] automated change (#5388)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* add smiley emoji (#5391)
* add smiley emoji
* clang-formatted
* Anable trace route function on wismeshtap platform (#5389)
* fix 'symbal' typo (#5395)
* [create-pull-request] automated change (#5399)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* /api/v1/fromradio: add OPTIONS handler for CORS. (#5386)
This avoids hitting the 404 Not Found handler, which breaks connection
keep-alive, so this change fixes a big performance regression for Web Client in
Chrome: https://github.com/meshtastic/firmware/issues/5385
Tested on Heltec V3.
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Make heart emoji usable (#5403)
* Create a specific hw_model for WisMesh Tap (#5400)
* Create a specific hw_model for WisMesh Tap
* Trunk
* HAS_ETHERNET
* Remove it altogether
* Don't need these either
* Fix RTC time injection and consolidate position logic (#5396)
* Fix RTC time injection and consolidate position logic
* Comment out unused var warning
* Backerds
* Update arduino-pico core to fix sporadic hangs (#5406)
* Update platform-raspberrypi also (#5407)
* Update arduino-pico core to fix sporadic hangs
* Update platform-raspberrypi also
* --web added to device-install(.sh/.bat) (#5405)
* Add --web
* Update device-install.bat
Forgot a "-" a few places.
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* add GPS in indicator board (#5411)
* Fixed NMEA sentence issue in CalTopo as well as bug with no printing all of the nodes (#5412)
* --web littlefswebui-* typo fix (#5416)
* Add --web
* Update device-install.bat
Forgot a "-" a few places.
* Typo fix.
* Typo fix
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: GUVWAF <78759985+GUVWAF@users.noreply.github.com>
* Temporarily disable MDNS when MQTT is enabled (#5418)
Leads to a panic
* Check for OkToMqtt flag presence before uplinking to MQTT (#5413)
* Check for oktomqtt flag presence before uplinking to MQTT
* Move to mqtt->onSend
* Temetry can respond to want-response for LocalStats variant (#5414)
* Seems like the last DIY board that's not "extra" (#5420)
* Cherry pick tdeck fixes (#5422)
* Try-fix (workaround) T-Deck audio crash
* set T-Deck audio to unused 48 (mem mclk)
* swap mclk to gpio 21
* dreamcatcher: assign GPIO44 to audio mclk
---------
Co-authored-by: mverch67 <manuel.verch@gmx.de>
* add canned message and keyboard in indicator board (#5410)
* add canned message and keyboard in indicator board
* Added virtual keyboard macro and enabled for Indicator
* Cleanup macros by applying USE_VIRTUAL_KEYBOARD and DISPLAY_CLOCK_FRAME
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Update build-native.sh (#5415)
* Update build-native.sh
Device-install.sh and device-update.sh are not used on native platform, skip copying to release directory after build and copy native-install.sh and native-run.sh instead.
* Update build-native.sh
Skip native-run.sh copy
* Cleans up visibility in GPS.h (#5426)
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
* Fix admin key loading from userPrefs.h (#5417)
* 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
* Fix warning: extra tokens at end of #endif directive.
* Fix antenna switching logic. Complementary-pin control logic is required on the rp2040-lora board.
* Fix deprecated macros.
* Set RP2040 in dormant mode when deep sleep is triggered.
* Fix array out of bounds read.
* Admin key count needs to be set otherwise the key will be zero loaded after reset.
* Don't reset the admin key size when loading defaults. Preserve an existing key in config if possible.
* Remove log spam when reading INA voltage sensor.
* Remove static declaration for admin keys from userPrefs.h. Load hard coded admin keys in case config file has empty slots.
* Removed newlines from log.
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
* try to detect dfrobot station to tell it apart from an ublox gps. (#5393)
* Remove BMA-423 and STK8X by default (#5429)
* Remove BMA-423 by default
* STK
* Wrong macro
* Helps if you include the file
* [create-pull-request] automated change (#5431)
Co-authored-by: caveman99 <25002+caveman99@users.noreply.github.com>
* Support for the ClimateGuard RadSens Geiger-Muller tube (#5425)
* fixes https://github.com/meshtastic/firmware/issues/5434 (#5435)
* update libpax
* fix interval init
* Fix memory leaks by adding missing `free()` calls before early returns in `MQTT::onReceive` (#5439)
This fix addresses memory leaks in the `MQTT::onReceive` function by ensuring that dynamically allocated resources (`e.channel_id`, `e.gateway_id` and `e.packet`) are properly freed before each early return. Previously, these resources were only freed at the end of the function, leaving them unhandled in certain exit paths. Adding the missing `free()` calls prevents memory leaks and ensures proper resource cleanup in all scenarios.
* Removing 1.0 legacy boards from releases and completely removing Heltec wireless capsule from support (#5436)
Co-authored-by: Tom Fifield <tom@tomfifield.net>
* A second round of cleanup on GPS.h. (#5433)
* Move yet more stuff out of GPS.h and into file scope.
* Protect code macros from eating semicolons.
* Remove unused (and unimplemented) getDOPString.
* clang-format with project style file on affected files.
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
* enable MQTT with TLS on RPi picow (#5442)
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Don't powersave on Wifi (#5443)
* Don't go into light sleep with wifi enabled
* Move
* Trunk
* Revert "Seems like the last DIY board that's not "extra" (#5420)" (#5446)
This reverts commit e6fb6b115aebb12b31fb93ed9d1508a6109b2f03.
* Actually gunzip all the files when building a .deb (#5449)
* [create-pull-request] automated change (#5457)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Cleanup i2c scan logs and macro to save some bytes and remain consistent (#5455)
* Cleanup i2c scan logs and macro to save some bytes and remain consistent
* Functions are better than macros
* Exclude i2c scan for STM32
* Useless log
* Clean up some inline functions (#5454)
* Use isWithinTimespanMs to avoid refererence to NodeDb instance inside of NodeDb (#5453)
* fix cors for meshtasticd to allow use of cross origin clients (#5463)
* Remove ATECC crypto chip placeholder code (#5461)
* GPS.h cleanups round 3. (#5447)
* GPS.h cleanups round 3.
No effective behavior change.
Protected members can be private so make it so. (Supporting
subclasses needs a lot more work.)
Moves uBloxGnssModelInfo into file scope.
Moves uBloxProtocolVersion into uBloxGnssModelInfo.
Moves baud rate arrays into file scope.
Removes unused/ unimplemented powerStateToString.
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
* Trunk Format.
---------
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
Co-authored-by: Tom Fifield <tom@tomfifield.net>
* Fix ukrainian fonts (#5468)
* FIX: rollback to !4624
* UPDATE: new 16 and 24 UA Fonts and fixes
* fix: Solve the lightsleep crash problem via disable lightsleep for indicator. (#5470)
* Trunk
* Warnings and log cleanup (#5472)
* Don't log if keyboard not found
* Signed comparison issue
* [create-pull-request] automated change (#5475)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Adds libusb dev package to Raspbian build steps (#5480)
* [create-pull-request] automated change (#5478)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Portduino fixes (#5479)
* Set config.yaml defaults even if General is missing
* Unsigned values should get %u in logging
* Update arduino-pico core and remove MDNS restriction (#5483)
* Update xiao_esp32 fully support L67K (#5488)
L67K module hardware changed
* Convert userprefs to a json file instead of header file which has to be included everywhere (#5471)
* WIP
* Got string quoting and macro expansion working
* Need the placeholder
* Cleanup
* Missed a user prefs reference
* Update jsonc
* SimRadio: clean-up and emulate collisions (#5487)
* Clean up SimRadio and don't let it use PKC
* Add collision emulation for SimRadio
* Add stats from SimRadio to LocalStats
* Make emulating collisions optional
* add nodeId to nodeinfo update log lines and removed redundant nodeinfo update log line (#5493)
* Refact the macro definition of GPS initialization of GPSDEFAULTD_NOT_PRESENT and added seeeed Indicator to this sequence (#5494)
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Extend Length of Source and Destination Node IDs Logged (#5492)
* show 8 chars for logging source and destination ids
* extend legnth of source and destination nodes in log
* Added femtofox configs (#5477)
* added femtofox configs
* Rename bin/config.d/femtofox_Waveshare-SX126X-XXXM_AI-Thinker-RA-01SH.yaml to bin/config.d/femtofox/femtofox_Waveshare-SX126X-XXXM_AI-Thinker-RA-01SH.yaml
* moved femtofox configs to subdir
* [Add] LR1110, LR1120 and LR1121 to linux native Portduino (#5496)
* Update main.cpp
* Update PortduinoGlue.h
* Update PortduinoGlue.cpp
* Update PortduinoGlue.cpp
* Update PortduinoGlue.cpp
* Update main.cpp
* [create-pull-request] automated change (#5500)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Fix minor typos in package workflows (#5505)
* Don't use channel index for encrypted packet (#5509)
* Don't use channel index for encrypted packet
* Remove assert in `getKey`, set invalid key length
So encrypting will fail without reboot
* Reset channel to 0 when unable to encrypt
Such that the NAK doesn't use the failing channel hash
* Always Announce MDNS meshtastic service (#5503)
* refactor server api port into define
* always announce MDNS meshtastic service
* fix nodeDB erase loop when free mem returns invalid value (0, -1). (#5519)
Co-authored-by: mverch67 <manuel.verch@gmx.de>
* Add heltec capsule back
* Revert "Add heltec capsule back"
This reverts commit fc16d9342116235fa86cf6ac163b17125bb4b50e.
* Lets try this again minus device ui
* Add popular nrf52 pro micro to the builds (#5523)
* Add MACAddress to config.yaml (#5506)
* Add MACAddress to config.yaml
* Better error handling on native, including failing to launch with blank MAC Address and real hardware.
* Re-arrange Mac Address handling and add MACAddressSource
* Bump portduino to remove macaddr function there
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
* Configure Seeed Xiao S3 RX enable pin (#5517)
* Create OpenWRT_One_mikroBUS_sx1262.yaml (#5529)
* tlora_v2_1_16: Unset BUTTON_PIN and BUTTON_NEED_PULLUP (#5535)
Unset BUTTON_PIN and BUTTON_NEED_PULLUP as the board ships without a user button.
Devices and users expecting a button on GPIO12 have to set [GPIO for user button](https://meshtastic.org/docs/configuration/radio/device/#gpio-for-user-button) to 12 (or any GPIO pin the momentary switch was connected to) to restore functionality.
Signed-off-by: Andrew Yong <me@ndoo.sg>
* [create-pull-request] automated change (#5530)
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
* Fix detection for some RadSens hardware versions (#5542)
Co-authored-by: Jake-B <jake-b@users.noreply.github.com>
* Initialize dmac array to nulls (#5538)
* Initialize dmac array to nulls
* Use std::cout for print before console is init.
* Update OpenWRT_One_mikroBUS_sx1262.yaml (#5544)
* Add portduino-buildroot variant (#5540)
* Add portduino-buildroot variant
* Update platform-native for platform-buildroot
* portduino-buildroot: Define c standard (#5547)
* Portduino: Move meshtasticd/web out of /usr/share/doc/ (#5548)
* Portduino: fix transitional symlinks (#5550)
* Windows Support - Trunk and Platformio (#5397) (#5518)
* Add support for GPG
* Add usb device support
* Add trunk.io to devcontainer
* Trunk things
* trunk fmt
* formatting
* fix trivy/DS002, checkov/CKV_DOCKER_3
* hide docker extension popup
* fix trivy/DS026, checkov/CKV_DOCKER_2
Co-authored-by: Kalle Lilja <15094562+ThatKalle@users.noreply.github.com>
* Synch minor changes from TFT branch (#5520)
* Synch minor changes from TFT branch
Includes:
* New nordicnrf52 minor version (10.5.0 --> 10.6.0)
* Optimisations for T_DECK
* preparation for MESH_TAB
* add ext notification module to portduino
---------
Co-authored-by: mverch67 <manuel.verch@gmx.de>
* DIO3_TCXO_VOLTAGE in config.yaml can now take an exact voltage (#5558)
* Support TLORA_V3.0 (#5563)
- Support TLORA_V3.0. Update of the legendary 2.1_1.6.1 with solar charger, TCXO and IPEX connector.
- 'extra' some short-lived EOL intermediate boards in that range. If possible use T3S3 instead of all of these!
- update trunk to latest version
* Create OpenWRT-One-mikroBUS-LR-IOT-CLICK.yaml (#5564)
* Portduino: fix setting hwId via argument (#5565)
* INA219 charging detection
minimal implementation: if there is a configured INA219 sensor for battery monitoring we can take the current flow across the shunt resistor to know if we are charging the battery - negative milliamps indicate charging
* Update Power.cpp
added comments and 2 extra defines to disable and swap detection direction
* Trunk Fixes
* Add INA226 support
---------
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
Signed-off-by: Andrew Yong <me@ndoo.sg>
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz>
Co-authored-by: GUVWAF <78759985+GUVWAF@users.noreply.github.com>
Co-authored-by: Tom Fifield <tom@tomfifield.net>
Co-authored-by: Michael Gjelsø <36234524+gjelsoe@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
Co-authored-by: jcyrio <50239349+jcyrio@users.noreply.github.com>
Co-authored-by: Daniel.Cao <144674500+DanielCao0@users.noreply.github.com>
Co-authored-by: Catalin Patulea <cronos586@gmail.com>
Co-authored-by: dylanli <dylan3000dylan@gmail.com>
Co-authored-by: mverch67 <manuel.verch@gmx.de>
Co-authored-by: madeofstown <33820964+madeofstown@users.noreply.github.com>
Co-authored-by: Christopher Hoover <ch@murgatroid.com>
Co-authored-by: Mictronics <github@mictronics.de>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
Co-authored-by: caveman99 <25002+caveman99@users.noreply.github.com>
Co-authored-by: jake-b <1012393+jake-b@users.noreply.github.com>
Co-authored-by: César de Tassis Filho <CTassisF@users.noreply.github.com>
Co-authored-by: Tomas Dubec <tomas.dubec@gmail.com>
Co-authored-by: Liam Cottle <liam@liamcottle.com>
Co-authored-by: panaceya <panaceya@users.noreply.github.com>
Co-authored-by: virgil <virgil.wang.cj@gmail.com>
Co-authored-by: Robert <r@rbrt.io>
Co-authored-by: noon92 <40807970+noon92@users.noreply.github.com>
Co-authored-by: Mark Trevor Birss <markbirss@gmail.com>
Co-authored-by: broglep <20624281+broglep@users.noreply.github.com>
Co-authored-by: Matthias Granberry <matthias.granberry@gmail.com>
Co-authored-by: Andrew Yong <me@ndoo.sg>
Co-authored-by: Jake-B <jake-b@users.noreply.github.com>
Co-authored-by: Austin <vidplace7@gmail.com>
Co-authored-by: Kalle Lilja <15094562+ThatKalle@users.noreply.github.com>
2024-12-22 05:02:50 +01:00
|
|
|
|
#endif
|