dont-reboot-v2
Ben Meadors 2024-05-08 14:01:54 -05:00
rodzic e948064e68
commit ace5e193f4
5 zmienionych plików z 20 dodań i 11 usunięć

Wyświetl plik

@ -1,3 +1,4 @@
#pragma once
#include "configuration.h"
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
@ -123,6 +124,7 @@ class AccelerometerThread : public concurrency::OSThread
// Duration is number of occurances needed to trigger, higher threshold is less sensitive
}
}
void start() { setIntervalFromNow(0); };
protected:
int32_t runOnce() override
@ -174,7 +176,7 @@ class AccelerometerThread : public concurrency::OSThread
Adafruit_LIS3DH lis;
Adafruit_LSM6DS3TRC lsm;
};
extern AccelerometerThread *accelerometerThread;
} // namespace concurrency
#endif

Wyświetl plik

@ -1,3 +1,5 @@
#pragma once
#include "configuration.h"
#ifdef HAS_NCP5623
@ -81,6 +83,7 @@ class AmbientLightingThread : public concurrency::OSThread
#endif
return disable();
}
void start() { setIntervalFromNow(0); };
private:
ScanI2C::DeviceType _type = ScanI2C::DeviceType::NONE;
@ -125,5 +128,6 @@ class AmbientLightingThread : public concurrency::OSThread
#endif
}
};
extern AmbientLightingThread *ambientLightingThread;
} // namespace concurrency

Wyświetl plik

@ -94,11 +94,6 @@ NRF52Bluetooth *nrf52Bluetooth;
#include "PowerFSMThread.h"
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
#include "AccelerometerThread.h"
#include "AmbientLightingThread.h"
#endif
#ifdef HAS_I2S
#include "AudioThread.h"
AudioThread *audioThread;
@ -197,10 +192,6 @@ uint32_t timeLastPowered = 0;
static Periodic *ledPeriodic;
static OSThread *powerFSMthread;
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
static OSThread *accelerometerThread;
#endif
static OSThread *ambientLightingThread;
SPISettings spiSettings(4000000, MSBFIRST, SPI_MODE0);
RadioInterface *rIf = NULL;

Wyświetl plik

@ -53,6 +53,11 @@ extern Adafruit_DRV2605 drv;
extern AudioThread *audioThread;
#endif
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
#include "AccelerometerThread.h"
#include "AmbientLightingThread.h"
#endif
extern bool isVibrating;
extern int TCPPort; // set by Portduino

Wyświetl plik

@ -26,6 +26,9 @@
#if !MESHTASTIC_EXCLUDE_GPS
#include "GPS.h"
#endif
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
#include "AccelerometerThread.h"
#endif
AdminModule *adminModule;
bool hasOpenEditTransaction;
@ -391,10 +394,14 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c)
config.has_display = true;
if (config.display.screen_on_secs == c.payload_variant.display.screen_on_secs &&
config.display.flip_screen == c.payload_variant.display.flip_screen &&
config.display.wake_on_tap_or_motion == c.payload_variant.display.wake_on_tap_or_motion &&
config.display.oled == c.payload_variant.display.oled) {
requiresReboot = false;
}
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
if (config.display.wake_on_tap_or_motion == false && c.payload_variant.display.wake_on_tap_or_motion == true) {
accelerometerThread->start();
}
#endif
config.display = c.payload_variant.display;
break;
case meshtastic_Config_lora_tag: