Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
thebentern committed Feb 9, 2024
2 parents f6d882e + d246c47 commit 7f2b68b
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 9 deletions.
1 change: 1 addition & 0 deletions boards/t-echo.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"f_cpu": "64000000L",
"hwids": [
["0x239A", "0x4405"],
["0x239A", "0x0029"],
["0x239A", "0x002A"]
],
"usb_product": "TTGO_eink",
Expand Down
2 changes: 1 addition & 1 deletion protobufs
22 changes: 17 additions & 5 deletions src/ButtonThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,18 @@ class ButtonThread : public concurrency::OSThread
if (settingsMap.count(user) != 0 && settingsMap[user] != RADIOLIB_NC)
userButton = OneButton(settingsMap[user], true, true);
#elif defined(BUTTON_PIN)

userButton = OneButton(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN, true, true);
int pin = config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN;
userButton = OneButton(pin, true, true);
#endif

#ifdef INPUT_PULLUP_SENSE
// Some platforms (nrf52) have a SENSE variant which allows wake from sleep - override what OneButton did
pinMode(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN, INPUT_PULLUP_SENSE);
pinMode(pin, INPUT_PULLUP_SENSE);
#endif
userButton.attachClick(userButtonPressed);
userButton.setClickMs(300);
userButton.setClickMs(400);
userButton.setPressMs(1000);
userButton.setDebounceMs(10);
userButton.attachDuringLongPress(userButtonPressedLong);
userButton.attachDoubleClick(userButtonDoublePressed);
userButton.attachMultiClick(userButtonMultiPressed);
Expand All @@ -72,7 +75,15 @@ class ButtonThread : public concurrency::OSThread
if (settingsMap.count(user) != 0 && settingsMap[user] != RADIOLIB_NC)
wakeOnIrq(settingsMap[user], FALLING);
#else
wakeOnIrq(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN, FALLING);
static OneButton *pBtn = &userButton; // only one instance of ButtonThread is created, so static is safe
attachInterrupt(
pin,
[]() {
BaseType_t higherWake = 0;
mainDelay.interruptFromISR(&higherWake);
pBtn->tick();
},
CHANGE);
#endif
#endif
#ifdef BUTTON_PIN_ALT
Expand Down Expand Up @@ -194,6 +205,7 @@ class ButtonThread : public concurrency::OSThread
{
if (!config.device.disable_triple_click && (gps != nullptr)) {
gps->toggleGpsMode();
screen->forceDisplay();
}
}

Expand Down
8 changes: 5 additions & 3 deletions src/mesh/generated/meshtastic/config.pb.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ typedef enum _meshtastic_Config_LoRaConfig_RegionCode {
/* Malaysia 433mhz */
meshtastic_Config_LoRaConfig_RegionCode_MY_433 = 16,
/* Malaysia 919mhz */
meshtastic_Config_LoRaConfig_RegionCode_MY_919 = 17
meshtastic_Config_LoRaConfig_RegionCode_MY_919 = 17,
/* Singapore 923mhz */
meshtastic_Config_LoRaConfig_RegionCode_SG_923 = 18
} meshtastic_Config_LoRaConfig_RegionCode;

/* Standard predefined channel settings
Expand Down Expand Up @@ -543,8 +545,8 @@ extern "C" {
#define _meshtastic_Config_DisplayConfig_DisplayMode_ARRAYSIZE ((meshtastic_Config_DisplayConfig_DisplayMode)(meshtastic_Config_DisplayConfig_DisplayMode_COLOR+1))

#define _meshtastic_Config_LoRaConfig_RegionCode_MIN meshtastic_Config_LoRaConfig_RegionCode_UNSET
#define _meshtastic_Config_LoRaConfig_RegionCode_MAX meshtastic_Config_LoRaConfig_RegionCode_MY_919
#define _meshtastic_Config_LoRaConfig_RegionCode_ARRAYSIZE ((meshtastic_Config_LoRaConfig_RegionCode)(meshtastic_Config_LoRaConfig_RegionCode_MY_919+1))
#define _meshtastic_Config_LoRaConfig_RegionCode_MAX meshtastic_Config_LoRaConfig_RegionCode_SG_923
#define _meshtastic_Config_LoRaConfig_RegionCode_ARRAYSIZE ((meshtastic_Config_LoRaConfig_RegionCode)(meshtastic_Config_LoRaConfig_RegionCode_SG_923+1))

#define _meshtastic_Config_LoRaConfig_ModemPreset_MIN meshtastic_Config_LoRaConfig_ModemPreset_LONG_FAST
#define _meshtastic_Config_LoRaConfig_ModemPreset_MAX meshtastic_Config_LoRaConfig_ModemPreset_LONG_MODERATE
Expand Down
1 change: 1 addition & 0 deletions variants/t-echo/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ debug_tool = jlink

# add -DCFG_SYSVIEW if you want to use the Segger systemview tool for OS profiling.
build_flags = ${nrf52840_base.build_flags} -Ivariants/t-echo
-DGPS_POWER_TOGGLE
-L "${platformio.libdeps_dir}/${this.__env__}/BSEC2 Software Library/src/cortex-m4/fpv4-sp-d16-hard"
build_src_filter = ${nrf52_base.build_src_filter} +<../variants/t-echo>
lib_deps =
Expand Down

0 comments on commit 7f2b68b

Please sign in to comment.