Skip to content

Commit

Permalink
Merge branch 'meshtastic:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Heltec-Aaron-Lee authored May 31, 2024
2 parents 3b31d10 + 10e3040 commit ec4bd88
Show file tree
Hide file tree
Showing 31 changed files with 1,391 additions and 98 deletions.
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"platformio.platformio-ide",
"trunk.io"
],
}
}
1 change: 1 addition & 0 deletions arch/esp32/esp32.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
; Common settings for ESP targes, mixin with extends = esp32_base
[esp32_base]
extends = arduino_base
custom_esp32_kind = esp32
platform = platformio/[email protected]

build_src_filter =
Expand Down
1 change: 1 addition & 0 deletions arch/esp32/esp32c3.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[esp32c3_base]
extends = esp32_base
custom_esp32_kind = esp32c3

monitor_speed = 115200
monitor_filters = esp32_c3_exception_decoder
1 change: 1 addition & 0 deletions arch/esp32/esp32s2.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[esp32s2_base]
extends = esp32_base
custom_esp32_kind = esp32s2

build_src_filter =
${esp32_base.build_src_filter} - <libpax/> -<nimble/> -<mesh/raspihttp>
Expand Down
1 change: 1 addition & 0 deletions arch/esp32/esp32s3.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[esp32s3_base]
extends = esp32_base
custom_esp32_kind = esp32s3

monitor_speed = 115200

2 changes: 1 addition & 1 deletion arch/portduino/portduino.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; The Portduino based sim environment on top of any host OS, all hardware will be simulated
[portduino_base]
platform = https://github.com/meshtastic/platform-native.git#f5ec3c031b0fcd89c0523de9e43eef3a92d59292
platform = https://github.com/meshtastic/platform-native.git#ad8112adf82ce1f5b917092cf32be07a077801a0
framework = arduino

build_src_filter =
Expand Down
16 changes: 15 additions & 1 deletion bin/platformio-custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,21 @@ def esp32_create_combined_bin(source, target, env):
import esptool

env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", esp32_create_combined_bin)
env.Append(LINKFLAGS=["--specs=nano.specs", "-u", "_printf_float"])

esp32_kind = env.GetProjectOption("custom_esp32_kind")
if esp32_kind == "esp32":
# Free up some IRAM by removing auxiliary SPI flash chip drivers.
# Wrapped stub symbols are defined in src/platform/esp32/iram-quirk.c.
env.Append(
LINKFLAGS=[
"-Wl,--wrap=esp_flash_chip_gd",
"-Wl,--wrap=esp_flash_chip_issi",
"-Wl,--wrap=esp_flash_chip_winbond",
]
)
else:
# For newer ESP32 targets, using newlib nano works better.
env.Append(LINKFLAGS=["--specs=nano.specs", "-u", "_printf_float"])

Import("projenv")

Expand Down
2 changes: 1 addition & 1 deletion protobufs
11 changes: 10 additions & 1 deletion src/PowerStatus.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,18 @@ class PowerStatus : public Status
int getBatteryVoltageMv() const { return batteryVoltageMv; }

/**
* Note: 0% battery means 'unknown/this board doesn't have a battery installed'
* Note: for boards with battery pin or PMU, 0% battery means 'unknown/this board doesn't have a battery installed'
*/
#if defined(HAS_PMU) || defined(BATTERY_PIN)
uint8_t getBatteryChargePercent() const { return getHasBattery() ? batteryChargePercent : 0; }
#endif

/**
* Note: for boards without battery pin and PMU, 101% battery means 'the board is using external power'
*/
#if !defined(HAS_PMU) && !defined(BATTERY_PIN)
uint8_t getBatteryChargePercent() const { return getHasBattery() ? batteryChargePercent : 101; }
#endif

bool matches(const PowerStatus *newStatus) const
{
Expand Down
8 changes: 6 additions & 2 deletions src/gps/RTC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,17 @@ void readFromRTC()
*
* If we haven't yet set our RTC this boot, set it from a GPS derived time
*/
bool perhapsSetRTC(RTCQuality q, const struct timeval *tv)
bool perhapsSetRTC(RTCQuality q, const struct timeval *tv, bool forceUpdate)
{
static uint32_t lastSetMsec = 0;
uint32_t now = millis();

bool shouldSet;
if (q > currentQuality) {
if (forceUpdate) {
shouldSet = true;
LOG_DEBUG("Overriding current RTC quality (%s) with incoming time of RTC quality of %s\n", RtcName(currentQuality),
RtcName(q));
} else if (q > currentQuality) {
shouldSet = true;
LOG_DEBUG("Upgrading time to quality %s\n", RtcName(q));
} else if (q >= RTCQualityNTP && (now - lastSetMsec) > (12 * 60 * 60 * 1000UL)) {
Expand Down
2 changes: 1 addition & 1 deletion src/gps/RTC.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ enum RTCQuality {
RTCQuality getRTCQuality();

/// If we haven't yet set our RTC this boot, set it from a GPS derived time
bool perhapsSetRTC(RTCQuality q, const struct timeval *tv);
bool perhapsSetRTC(RTCQuality q, const struct timeval *tv, bool forceUpdate = false);
bool perhapsSetRTC(RTCQuality q, struct tm &t);

/// Return a string name for the quality
Expand Down
4 changes: 4 additions & 0 deletions src/graphics/PointStruct.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
struct PointStruct {
int x;
int y;
};
Loading

0 comments on commit ec4bd88

Please sign in to comment.