mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-14 14:52:32 +00:00
* Add variant_shutdown() as a week function in main-nrf52.cpp * Add Status LED module * Add Thinknode M3 support * Catch case of BLE disabled * Update src/modules/StatusLEDModule.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/modules/StatusLEDModule.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update variants/nrf52840/ELECROW-ThinkNode-M3/rfswitch.h Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Remove unused pin * M3 pairing LED only active for 30 seconds after state change * Thinknode M3 shutdown work --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
45 lines
1.2 KiB
C++
45 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include "BluetoothStatus.h"
|
|
#include "MeshModule.h"
|
|
#include "PowerStatus.h"
|
|
#include "concurrency/OSThread.h"
|
|
#include "configuration.h"
|
|
#include <Arduino.h>
|
|
#include <functional>
|
|
|
|
class StatusLEDModule : private concurrency::OSThread
|
|
{
|
|
bool slowTrack = false;
|
|
|
|
public:
|
|
StatusLEDModule();
|
|
|
|
int handleStatusUpdate(const meshtastic::Status *);
|
|
|
|
protected:
|
|
unsigned int my_interval = 1000; // interval in millisconds
|
|
virtual int32_t runOnce() override;
|
|
|
|
CallbackObserver<StatusLEDModule, const meshtastic::Status *> bluetoothStatusObserver =
|
|
CallbackObserver<StatusLEDModule, const meshtastic::Status *>(this, &StatusLEDModule::handleStatusUpdate);
|
|
CallbackObserver<StatusLEDModule, const meshtastic::Status *> powerStatusObserver =
|
|
CallbackObserver<StatusLEDModule, const meshtastic::Status *>(this, &StatusLEDModule::handleStatusUpdate);
|
|
|
|
private:
|
|
bool CHARGE_LED_state = LED_STATE_OFF;
|
|
bool PAIRING_LED_state = LED_STATE_OFF;
|
|
|
|
uint32_t PAIRING_LED_starttime = 0;
|
|
|
|
enum PowerState { discharging, charging, charged };
|
|
|
|
PowerState power_state = discharging;
|
|
|
|
enum BLEState { unpaired, pairing, connected };
|
|
|
|
BLEState ble_state = unpaired;
|
|
};
|
|
|
|
extern StatusLEDModule *statusLEDModule;
|