mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-18 11:02:16 +00:00
Merge branch 'master' into 2264-feature-check-for-low-heap-before-adding-to-nodedb-was-reboot-loop-heap-too-low
This commit is contained in:
commit
8db7316ae1
@ -123,9 +123,6 @@ class ButtonThread : public concurrency::OSThread
|
|||||||
static void userButtonPressedLong()
|
static void userButtonPressedLong()
|
||||||
{
|
{
|
||||||
// LOG_DEBUG("Long press!\n");
|
// LOG_DEBUG("Long press!\n");
|
||||||
#ifdef ARCH_ESP32
|
|
||||||
screen->adjustBrightness();
|
|
||||||
#endif
|
|
||||||
// If user button is held down for 5 seconds, shutdown the device.
|
// If user button is held down for 5 seconds, shutdown the device.
|
||||||
if ((millis() - longPressTime > 5 * 1000) && (longPressTime > 0)) {
|
if ((millis() - longPressTime > 5 * 1000) && (longPressTime > 0)) {
|
||||||
#ifdef HAS_PMU
|
#ifdef HAS_PMU
|
||||||
@ -133,7 +130,7 @@ class ButtonThread : public concurrency::OSThread
|
|||||||
setLed(false);
|
setLed(false);
|
||||||
power->shutdown();
|
power->shutdown();
|
||||||
}
|
}
|
||||||
#elif defined(ARCH_NRF52)
|
#elif defined(ARCH_NRF52) || defined(ARCH_ESP32)
|
||||||
// Do actual shutdown when button released, otherwise the button release
|
// Do actual shutdown when button released, otherwise the button release
|
||||||
// may wake the board immediatedly.
|
// may wake the board immediatedly.
|
||||||
if ((!shutdown_on_long_stop) && (millis() > 30 * 1000)) {
|
if ((!shutdown_on_long_stop) && (millis() > 30 * 1000)) {
|
||||||
|
@ -13,6 +13,10 @@
|
|||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef DELAY_FOREVER
|
||||||
|
#define DELAY_FOREVER portMAX_DELAY
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAS_PMU
|
#ifdef HAS_PMU
|
||||||
#include "XPowersAXP192.tpp"
|
#include "XPowersAXP192.tpp"
|
||||||
#include "XPowersAXP2101.tpp"
|
#include "XPowersAXP2101.tpp"
|
||||||
@ -256,16 +260,24 @@ void Power::shutdown()
|
|||||||
digitalWrite(PIN_EINK_EN, LOW); // power off backlight first
|
digitalWrite(PIN_EINK_EN, LOW); // power off backlight first
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAS_PMU
|
|
||||||
LOG_INFO("Shutting down\n");
|
LOG_INFO("Shutting down\n");
|
||||||
|
|
||||||
|
#ifdef HAS_PMU
|
||||||
if (PMU) {
|
if (PMU) {
|
||||||
PMU->setChargingLedMode(XPOWERS_CHG_LED_OFF);
|
PMU->setChargingLedMode(XPOWERS_CHG_LED_OFF);
|
||||||
PMU->shutdown();
|
|
||||||
}
|
}
|
||||||
#elif defined(ARCH_NRF52)
|
#endif
|
||||||
playBeep();
|
|
||||||
|
#if defined(ARCH_NRF52) || defined(ARCH_ESP32)
|
||||||
|
#ifdef PIN_LED1
|
||||||
ledOff(PIN_LED1);
|
ledOff(PIN_LED1);
|
||||||
|
#endif
|
||||||
|
#ifdef PIN_LED2
|
||||||
ledOff(PIN_LED2);
|
ledOff(PIN_LED2);
|
||||||
|
#endif
|
||||||
|
#ifdef PIN_LED3
|
||||||
|
ledOff(PIN_LED2);
|
||||||
|
#endif
|
||||||
doDeepSleep(DELAY_FOREVER);
|
doDeepSleep(DELAY_FOREVER);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ class Screen
|
|||||||
void startBluetoothPinScreen(uint32_t pin) {}
|
void startBluetoothPinScreen(uint32_t pin) {}
|
||||||
void stopBluetoothPinScreen() {}
|
void stopBluetoothPinScreen() {}
|
||||||
void startRebootScreen() {}
|
void startRebootScreen() {}
|
||||||
|
void startShutdownScreen() {}
|
||||||
void startFirmwareUpdateScreen() {}
|
void startFirmwareUpdateScreen() {}
|
||||||
};
|
};
|
||||||
} // namespace graphics
|
} // namespace graphics
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "InputBroker.h"
|
#include "InputBroker.h"
|
||||||
#include "SinglePortModule.h" // TODO: what header file to include?
|
#include "concurrency/OSThread.h"
|
||||||
|
#include "mesh/NodeDB.h"
|
||||||
|
|
||||||
enum RotaryEncoderInterruptBaseStateType { ROTARY_EVENT_OCCURRED, ROTARY_EVENT_CLEARED };
|
enum RotaryEncoderInterruptBaseStateType { ROTARY_EVENT_OCCURRED, ROTARY_EVENT_CLEARED };
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "InputBroker.h"
|
#include "InputBroker.h"
|
||||||
#include "SinglePortModule.h" // TODO: what header file to include?
|
#include "mesh/NodeDB.h"
|
||||||
|
|
||||||
class UpDownInterruptBase : public Observable<const InputEvent *>
|
class UpDownInterruptBase : public Observable<const InputEvent *>
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "InputBroker.h"
|
#include "InputBroker.h"
|
||||||
#include "SinglePortModule.h" // TODO: what header file to include?
|
|
||||||
#include "Wire.h"
|
#include "Wire.h"
|
||||||
|
#include "concurrency/OSThread.h"
|
||||||
|
|
||||||
class KbI2cBase : public Observable<const InputEvent *>, public concurrency::OSThread
|
class KbI2cBase : public Observable<const InputEvent *>, public concurrency::OSThread
|
||||||
{
|
{
|
||||||
|
@ -36,6 +36,9 @@
|
|||||||
#ifndef HAS_RTC
|
#ifndef HAS_RTC
|
||||||
#define HAS_RTC 1
|
#define HAS_RTC 1
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef HAS_CPU_SHUTDOWN
|
||||||
|
#define HAS_CPU_SHUTDOWN 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(HAS_AXP192) || defined(HAS_AXP2101)
|
#if defined(HAS_AXP192) || defined(HAS_AXP2101)
|
||||||
#define HAS_PMU
|
#define HAS_PMU
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#ifndef HAS_RADIO
|
#ifndef HAS_RADIO
|
||||||
#define HAS_RADIO 1
|
#define HAS_RADIO 1
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAS_CPU_SHUTDOWN
|
#ifndef HAS_CPU_SHUTDOWN
|
||||||
#define HAS_CPU_SHUTDOWN 1
|
#define HAS_CPU_SHUTDOWN 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -18,31 +18,16 @@ void powerCommandsCheck()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ARCH_NRF52) || defined(HAS_PMU)
|
#if defined(ARCH_ESP32) || defined(ARCH_NRF52)
|
||||||
if (shutdownAtMsec) {
|
if (shutdownAtMsec) {
|
||||||
screen->startShutdownScreen();
|
screen->startShutdownScreen();
|
||||||
playBeep();
|
|
||||||
#ifdef PIN_LED1
|
|
||||||
ledOff(PIN_LED1);
|
|
||||||
#endif
|
|
||||||
#ifdef PIN_LED2
|
|
||||||
ledOff(PIN_LED2);
|
|
||||||
#endif
|
|
||||||
#ifdef PIN_LED3
|
|
||||||
ledOff(PIN_LED3);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (shutdownAtMsec && millis() > shutdownAtMsec) {
|
if (shutdownAtMsec && millis() > shutdownAtMsec) {
|
||||||
LOG_INFO("Shutting down from admin command\n");
|
LOG_INFO("Shutting down from admin command\n");
|
||||||
#ifdef HAS_PMU
|
|
||||||
if (pmu_found == true) {
|
|
||||||
playShutdownMelody();
|
|
||||||
power->shutdown();
|
|
||||||
}
|
|
||||||
#elif defined(ARCH_NRF52)
|
|
||||||
playShutdownMelody();
|
playShutdownMelody();
|
||||||
|
#if defined(ARCH_NRF52) || defined(ARCH_ESP32)
|
||||||
power->shutdown();
|
power->shutdown();
|
||||||
#else
|
#else
|
||||||
LOG_WARN("FIXME implement shutdown for this platform");
|
LOG_WARN("FIXME implement shutdown for this platform");
|
||||||
|
Loading…
Reference in New Issue
Block a user