mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-26 09:59:01 +00:00
Format plz
This commit is contained in:
parent
6a5e0edb60
commit
384eac9a87
@ -17,8 +17,7 @@ namespace concurrency
|
|||||||
{
|
{
|
||||||
attachInterrupt(
|
attachInterrupt(
|
||||||
irq,
|
irq,
|
||||||
[]
|
[] {
|
||||||
{
|
|
||||||
BaseType_t higherWake = 0;
|
BaseType_t higherWake = 0;
|
||||||
mainDelay.interruptFromISR(&higherWake);
|
mainDelay.interruptFromISR(&higherWake);
|
||||||
},
|
},
|
||||||
@ -116,8 +115,7 @@ namespace concurrency
|
|||||||
{
|
{
|
||||||
// LOG_DEBUG("press!\n");
|
// LOG_DEBUG("press!\n");
|
||||||
#ifdef BUTTON_PIN
|
#ifdef BUTTON_PIN
|
||||||
if ((BUTTON_PIN != moduleConfig.canned_message.inputbroker_pin_press) || !moduleConfig.canned_message.enabled)
|
if ((BUTTON_PIN != moduleConfig.canned_message.inputbroker_pin_press) || !moduleConfig.canned_message.enabled) {
|
||||||
{
|
|
||||||
powerFSM.trigger(EVENT_PRESS);
|
powerFSM.trigger(EVENT_PRESS);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -129,19 +127,16 @@ namespace concurrency
|
|||||||
screen->adjustBrightness();
|
screen->adjustBrightness();
|
||||||
#endif
|
#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
|
||||||
if (pmu_found == true)
|
if (pmu_found == true) {
|
||||||
{
|
|
||||||
setLed(false);
|
setLed(false);
|
||||||
power->shutdown();
|
power->shutdown();
|
||||||
}
|
}
|
||||||
#elif defined(ARCH_NRF52)
|
#elif defined(ARCH_NRF52)
|
||||||
// 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)) {
|
||||||
{
|
|
||||||
screen->startShutdownScreen();
|
screen->startShutdownScreen();
|
||||||
LOG_INFO("Shutdown from long press");
|
LOG_INFO("Shutdown from long press");
|
||||||
playBeep();
|
playBeep();
|
||||||
@ -157,9 +152,7 @@ namespace concurrency
|
|||||||
shutdown_on_long_stop = true;
|
shutdown_on_long_stop = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
// LOG_DEBUG("Long press %u\n", (millis() - longPressTime));
|
// LOG_DEBUG("Long press %u\n", (millis() - longPressTime));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -177,12 +170,9 @@ namespace concurrency
|
|||||||
static void userButtonMultiPressed()
|
static void userButtonMultiPressed()
|
||||||
{
|
{
|
||||||
#if defined(GPS_POWER_TOGGLE)
|
#if defined(GPS_POWER_TOGGLE)
|
||||||
if (config.position.gps_enabled)
|
if (config.position.gps_enabled) {
|
||||||
{
|
|
||||||
LOG_DEBUG("Flag set to false for gps power\n");
|
LOG_DEBUG("Flag set to false for gps power\n");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG_DEBUG("Flag set to true to restore power\n");
|
LOG_DEBUG("Flag set to true to restore power\n");
|
||||||
}
|
}
|
||||||
config.position.gps_enabled = !(config.position.gps_enabled);
|
config.position.gps_enabled = !(config.position.gps_enabled);
|
||||||
@ -192,8 +182,7 @@ namespace concurrency
|
|||||||
|
|
||||||
static void userButtonPressedLongStart()
|
static void userButtonPressedLongStart()
|
||||||
{
|
{
|
||||||
if (millis() > 30 * 1000)
|
if (millis() > 30 * 1000) {
|
||||||
{
|
|
||||||
LOG_DEBUG("Long press start!\n");
|
LOG_DEBUG("Long press start!\n");
|
||||||
longPressTime = millis();
|
longPressTime = millis();
|
||||||
}
|
}
|
||||||
@ -201,12 +190,10 @@ namespace concurrency
|
|||||||
|
|
||||||
static void userButtonPressedLongStop()
|
static void userButtonPressedLongStop()
|
||||||
{
|
{
|
||||||
if (millis() > 30 * 1000)
|
if (millis() > 30 * 1000) {
|
||||||
{
|
|
||||||
LOG_DEBUG("Long press stop!\n");
|
LOG_DEBUG("Long press stop!\n");
|
||||||
longPressTime = 0;
|
longPressTime = 0;
|
||||||
if (shutdown_on_long_stop)
|
if (shutdown_on_long_stop) {
|
||||||
{
|
|
||||||
playShutdownMelody();
|
playShutdownMelody();
|
||||||
delay(3000);
|
delay(3000);
|
||||||
power->shutdown();
|
power->shutdown();
|
||||||
|
Loading…
Reference in New Issue
Block a user