mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-23 19:20:41 +00:00
Add battery sensing (mostly) for TBEAM0.7
However, disabled until someone with suitable hardware can test and report back. @slavino and @tschundler would you be willing to try it with your boards? You'll need to uncomment the following line in configuration.h // #define BATTERY_PIN 35 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
This commit is contained in:
22
src/power.h
22
src/power.h
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include "concurrency/PeriodicTask.h"
|
||||
#include "PowerStatus.h"
|
||||
#include "concurrency/PeriodicTask.h"
|
||||
|
||||
/**
|
||||
* Per @spattinson
|
||||
@@ -18,23 +18,23 @@
|
||||
class Power : public concurrency::PeriodicTask
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
public:
|
||||
Observable<const meshtastic::PowerStatus *> newStatus;
|
||||
|
||||
void readPowerStatus();
|
||||
void loop();
|
||||
virtual bool setup();
|
||||
virtual void doTask();
|
||||
void setStatusHandler(meshtastic::PowerStatus *handler)
|
||||
{
|
||||
statusHandler = handler;
|
||||
}
|
||||
|
||||
protected:
|
||||
meshtastic::PowerStatus *statusHandler;
|
||||
virtual void axp192Init();
|
||||
void setStatusHandler(meshtastic::PowerStatus *handler) { statusHandler = handler; }
|
||||
|
||||
protected:
|
||||
meshtastic::PowerStatus *statusHandler;
|
||||
|
||||
/// Setup a axp192, return true if found
|
||||
bool axp192Init();
|
||||
|
||||
/// Setup a simple ADC input based battery sensor
|
||||
bool analogInit();
|
||||
};
|
||||
|
||||
extern Power *power;
|
||||
Reference in New Issue
Block a user