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:
geeksville
2020-08-12 17:03:36 -07:00
parent c30b570e16
commit 6a402b13fa
5 changed files with 131 additions and 57 deletions

View File

@@ -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;