Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion examples/simple_repeater/UITask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
#include <Arduino.h>
#include <helpers/CommonCLI.h>

#ifndef USER_BTN_PRESSED
#define USER_BTN_PRESSED LOW
#endif

#define AUTO_OFF_MILLIS 20000 // 20 seconds
#define BOOT_SCREEN_MILLIS 4000 // 4 seconds

Expand Down Expand Up @@ -85,7 +89,7 @@ void UITask::loop() {
if (millis() >= _next_read) {
int btnState = digitalRead(PIN_USER_BTN);
if (btnState != _prevBtnState) {
if (btnState == LOW) { // pressed?
if (btnState == USER_BTN_PRESSED) { // pressed?
if (_display->isOn()) {
// TODO: any action ?
} else {
Expand Down
6 changes: 5 additions & 1 deletion examples/simple_room_server/UITask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
#include <Arduino.h>
#include <helpers/CommonCLI.h>

#ifndef USER_BTN_PRESSED
#define USER_BTN_PRESSED LOW
#endif

#define AUTO_OFF_MILLIS 20000 // 20 seconds
#define BOOT_SCREEN_MILLIS 4000 // 4 seconds

Expand Down Expand Up @@ -85,7 +89,7 @@ void UITask::loop() {
if (millis() >= _next_read) {
int btnState = digitalRead(PIN_USER_BTN);
if (btnState != _prevBtnState) {
if (btnState == LOW) { // pressed?
if (btnState == USER_BTN_PRESSED) { // pressed?
if (_display->isOn()) {
// TODO: any action ?
} else {
Expand Down
6 changes: 5 additions & 1 deletion examples/simple_sensor/UITask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
#include <Arduino.h>
#include <helpers/CommonCLI.h>

#ifndef USER_BTN_PRESSED
#define USER_BTN_PRESSED LOW
#endif

#define AUTO_OFF_MILLIS 20000 // 20 seconds
#define BOOT_SCREEN_MILLIS 4000 // 4 seconds

Expand Down Expand Up @@ -85,7 +89,7 @@ void UITask::loop() {
if (millis() >= _next_read) {
int btnState = digitalRead(PIN_USER_BTN);
if (btnState != _prevBtnState) {
if (btnState == LOW) { // pressed?
if (btnState == USER_BTN_PRESSED) { // pressed?
if (_display->isOn()) {
// TODO: any action ?
} else {
Expand Down
4 changes: 4 additions & 0 deletions src/helpers/ESP32Board.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
#include <MeshCore.h>
#include <Arduino.h>

#ifndef USER_BTN_PRESSED
#define USER_BTN_PRESSED LOW
#endif

#if defined(ESP_PLATFORM)

#include <rom/rtc.h>
Expand Down
2 changes: 1 addition & 1 deletion variants/minewsemi_me25ls01/MinewsemiME25LS01Board.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class MinewsemiME25LS01Board : public NRF52BoardDCDC {
digitalWrite(LED_PIN, LOW);
#endif
#ifdef BUTTON_PIN
nrf_gpio_cfg_sense_input(digitalPinToInterrupt(BUTTON_PIN), NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_HIGH);
nrf_gpio_cfg_sense_input(digitalPinToInterrupt(BUTTON_PIN), NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);
#endif
sd_power_system_off();
}
Expand Down
1 change: 0 additions & 1 deletion variants/minewsemi_me25ls01/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ build_flags = ${nrf52840_me25ls01.build_flags}
-I variants/minewsemi_me25ls01
-D me25ls01
-D PIN_USER_BTN=27
-D USER_BTN_PRESSED=HIGH
-D PIN_STATUS_LED=39
-D P_LORA_TX_LED=22
-D RADIO_CLASS=CustomLR1110
Expand Down
4 changes: 2 additions & 2 deletions variants/t1000-e/T1000eBoard.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ class T1000eBoard : public NRF52BoardDCDC {
digitalWrite(LED_PIN, HIGH);
#endif
#ifdef BUTTON_PIN
while(digitalRead(BUTTON_PIN));
while(digitalRead(BUTTON_PIN) == LOW);
#endif
#ifdef LED_PIN
digitalWrite(LED_PIN, LOW);
#endif

#ifdef BUTTON_PIN
nrf_gpio_cfg_sense_input(BUTTON_PIN, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_HIGH);
nrf_gpio_cfg_sense_input(BUTTON_PIN, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_LOW);
#endif

sd_power_system_off();
Expand Down
1 change: 0 additions & 1 deletion variants/t1000-e/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ build_flags = ${nrf52_base.build_flags}
-I src/helpers/ui
-D T1000_E
-D PIN_USER_BTN=6
-D USER_BTN_PRESSED=HIGH
-D PIN_STATUS_LED=24
-D RADIO_CLASS=CustomLR1110
-D WRAPPER_CLASS=CustomLR1110Wrapper
Expand Down
1 change: 0 additions & 1 deletion variants/thinknode_m3/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ build_flags = ${nrf52_base.build_flags}
-I src/helpers/ui
-D THINKNODE_M3
-D PIN_USER_BTN=12
-D USER_BTN_PRESSED=LOW
-D PIN_STATUS_LED=35
-D RADIO_CLASS=CustomLR1110
-D WRAPPER_CLASS=CustomLR1110Wrapper
Expand Down
1 change: 0 additions & 1 deletion variants/wio-e5-mini/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ build_flags = ${stm32_base.build_flags}
-D RX_BOOSTED_GAIN=true
-D P_LORA_TX_LED=LED_RED
-D PIN_USER_BTN=USER_BTN
-D USER_BTN_PRESSED=LOW
-I variants/wio-e5-mini
build_src_filter = ${stm32_base.build_src_filter}
+<../variants/wio-e5-mini>
Expand Down
6 changes: 5 additions & 1 deletion variants/xiao_nrf52/XiaoNrf52Board.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
#include <Arduino.h>
#include <helpers/NRF52Board.h>

#ifndef USER_BTN_PRESSED
#define USER_BTN_PRESSED LOW
#endif

#ifdef XIAO_NRF52

class XiaoNrf52Board : public NRF52BoardDCDC {
Expand Down Expand Up @@ -35,7 +39,7 @@ class XiaoNrf52Board : public NRF52BoardDCDC {
// set led on and wait for button release before poweroff
digitalWrite(PIN_LED, LOW);
#ifdef PIN_USER_BTN
while(digitalRead(PIN_USER_BTN) == LOW);
while(digitalRead(PIN_USER_BTN) == USER_BTN_PRESSED);
#endif
digitalWrite(LED_GREEN, HIGH);
digitalWrite(LED_BLUE, HIGH);
Expand Down