mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-27 10:21:40 +00:00
Merge branch 'dev-https' into spiffs-bug496
This commit is contained in:
commit
cc36e3a9a6
@ -134,6 +134,14 @@ bool Power::setup()
|
|||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Power::shutdown()
|
||||||
|
{
|
||||||
|
#ifdef TBEAM_V10
|
||||||
|
DEBUG_MSG("Shutting down\n");
|
||||||
|
axp.shutdown();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/// Reads power status to powerStatus singleton.
|
/// Reads power status to powerStatus singleton.
|
||||||
//
|
//
|
||||||
// TODO(girts): move this and other axp stuff to power.h/power.cpp.
|
// TODO(girts): move this and other axp stuff to power.h/power.cpp.
|
||||||
|
24
src/main.cpp
24
src/main.cpp
@ -168,6 +168,8 @@ class ButtonThread : public OSThread
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static uint32_t longPressTime;
|
||||||
|
|
||||||
// callback returns the period for the next callback invocation (or 0 if we should no longer be called)
|
// callback returns the period for the next callback invocation (or 0 if we should no longer be called)
|
||||||
ButtonThread() : OSThread("Button")
|
ButtonThread() : OSThread("Button")
|
||||||
{
|
{
|
||||||
@ -180,6 +182,8 @@ class ButtonThread : public OSThread
|
|||||||
userButton.attachClick(userButtonPressed);
|
userButton.attachClick(userButtonPressed);
|
||||||
userButton.attachDuringLongPress(userButtonPressedLong);
|
userButton.attachDuringLongPress(userButtonPressedLong);
|
||||||
userButton.attachDoubleClick(userButtonDoublePressed);
|
userButton.attachDoubleClick(userButtonDoublePressed);
|
||||||
|
userButton.attachLongPressStart(userButtonPressedLongStart);
|
||||||
|
userButton.attachLongPressStop(userButtonPressedLongStop);
|
||||||
wakeOnIrq(BUTTON_PIN, FALLING);
|
wakeOnIrq(BUTTON_PIN, FALLING);
|
||||||
#endif
|
#endif
|
||||||
#ifdef BUTTON_PIN_ALT
|
#ifdef BUTTON_PIN_ALT
|
||||||
@ -191,6 +195,8 @@ class ButtonThread : public OSThread
|
|||||||
userButtonAlt.attachClick(userButtonPressed);
|
userButtonAlt.attachClick(userButtonPressed);
|
||||||
userButtonAlt.attachDuringLongPress(userButtonPressedLong);
|
userButtonAlt.attachDuringLongPress(userButtonPressedLong);
|
||||||
userButtonAlt.attachDoubleClick(userButtonDoublePressed);
|
userButtonAlt.attachDoubleClick(userButtonDoublePressed);
|
||||||
|
userButtonAlt.attachLongPressStart(userButtonPressedLongStart);
|
||||||
|
userButtonAlt.attachLongPressStop(userButtonPressedLongStop);
|
||||||
wakeOnIrq(BUTTON_PIN_ALT, FALLING);
|
wakeOnIrq(BUTTON_PIN_ALT, FALLING);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -223,8 +229,19 @@ class ButtonThread : public OSThread
|
|||||||
}
|
}
|
||||||
static void userButtonPressedLong()
|
static void userButtonPressedLong()
|
||||||
{
|
{
|
||||||
DEBUG_MSG("Long press!\n");
|
// DEBUG_MSG("Long press!\n");
|
||||||
screen->adjustBrightness();
|
screen->adjustBrightness();
|
||||||
|
|
||||||
|
// If user button is held down for 10 seconds, shutdown the device.
|
||||||
|
if (millis() - longPressTime > 10 * 1000) {
|
||||||
|
#ifdef TBEAM_V10
|
||||||
|
if (axp192_found == true) {
|
||||||
|
power->shutdown();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
//DEBUG_MSG("Long press %u\n", (millis() - longPressTime));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void userButtonDoublePressed()
|
static void userButtonDoublePressed()
|
||||||
@ -237,6 +254,7 @@ class ButtonThread : public OSThread
|
|||||||
|
|
||||||
static Periodic *ledPeriodic;
|
static Periodic *ledPeriodic;
|
||||||
static OSThread *powerFSMthread, *buttonThread;
|
static OSThread *powerFSMthread, *buttonThread;
|
||||||
|
uint32_t ButtonThread::longPressTime = 0;
|
||||||
|
|
||||||
RadioInterface *rIf = NULL;
|
RadioInterface *rIf = NULL;
|
||||||
|
|
||||||
@ -246,6 +264,10 @@ void setup()
|
|||||||
SEGGER_RTT_ConfigUpBuffer(SEGGER_STDOUT_CH, NULL, NULL, 1024, SEGGER_RTT_MODE_NO_BLOCK_TRIM);
|
SEGGER_RTT_ConfigUpBuffer(SEGGER_STDOUT_CH, NULL, NULL, 1024, SEGGER_RTT_MODE_NO_BLOCK_TRIM);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_SEGGER
|
||||||
|
SEGGER_RTT_ConfigUpBuffer(0, NULL, NULL, 0, SEGGER_RTT_MODE_NO_BLOCK_TRIM);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Debug
|
// Debug
|
||||||
#ifdef DEBUG_PORT
|
#ifdef DEBUG_PORT
|
||||||
DEBUG_PORT.init(); // Set serial baud rate and init our mesh console
|
DEBUG_PORT.init(); // Set serial baud rate and init our mesh console
|
||||||
|
@ -254,7 +254,7 @@ void RadioLibInterface::handleReceiveInterrupt()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** start an immediate transmit */
|
/** start an immediate transmit */
|
||||||
void RadioLibInterface::startSend(MeshPacket *txp)
|
void RadioLibInterface::startSend(MeshPacket *txp)
|
||||||
{
|
{
|
||||||
|
@ -23,6 +23,7 @@ class Power : private concurrency::OSThread
|
|||||||
|
|
||||||
Power();
|
Power();
|
||||||
|
|
||||||
|
void shutdown();
|
||||||
void readPowerStatus();
|
void readPowerStatus();
|
||||||
virtual bool setup();
|
virtual bool setup();
|
||||||
virtual int32_t runOnce();
|
virtual int32_t runOnce();
|
||||||
|
Loading…
Reference in New Issue
Block a user