mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-08 22:22:05 +00:00
Replace TBEAM_V10 macro guards with more appropriate HAS_AXP192. Also eliminates symbol redefinition of AXP192_SLAVE_ADDRESS
This commit is contained in:
parent
401b5d92aa
commit
6382f67b89
@ -7,9 +7,7 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "buzz/buzz.h"
|
#include "buzz/buzz.h"
|
||||||
|
|
||||||
#ifdef TBEAM_V10
|
#ifdef HAS_AXP192
|
||||||
// FIXME. nasty hack cleanup how we load axp192
|
|
||||||
#undef AXP192_SLAVE_ADDRESS
|
|
||||||
#include "axp20x.h"
|
#include "axp20x.h"
|
||||||
|
|
||||||
AXP20X_Class axp;
|
AXP20X_Class axp;
|
||||||
@ -221,7 +219,7 @@ bool Power::setup()
|
|||||||
|
|
||||||
void Power::shutdown()
|
void Power::shutdown()
|
||||||
{
|
{
|
||||||
#ifdef TBEAM_V10
|
#ifdef HAS_AXP192
|
||||||
DEBUG_MSG("Shutting down\n");
|
DEBUG_MSG("Shutting down\n");
|
||||||
axp.setChgLEDMode(AXP20X_LED_OFF);
|
axp.setChgLEDMode(AXP20X_LED_OFF);
|
||||||
axp.shutdown();
|
axp.shutdown();
|
||||||
@ -293,7 +291,7 @@ int32_t Power::runOnce()
|
|||||||
{
|
{
|
||||||
readPowerStatus();
|
readPowerStatus();
|
||||||
|
|
||||||
#ifdef TBEAM_V10
|
#ifdef HAS_AXP192
|
||||||
// WE no longer use the IRQ line to wake the CPU (due to false wakes from sleep), but we do poll
|
// WE no longer use the IRQ line to wake the CPU (due to false wakes from sleep), but we do poll
|
||||||
// the IRQ status by reading the registers over I2C
|
// the IRQ status by reading the registers over I2C
|
||||||
axp.readIRQ();
|
axp.readIRQ();
|
||||||
@ -343,7 +341,7 @@ int32_t Power::runOnce()
|
|||||||
*/
|
*/
|
||||||
bool Power::axp192Init()
|
bool Power::axp192Init()
|
||||||
{
|
{
|
||||||
#ifdef TBEAM_V10
|
#ifdef HAS_AXP192
|
||||||
if (axp192_found) {
|
if (axp192_found) {
|
||||||
if (!axp.begin(Wire, AXP192_SLAVE_ADDRESS)) {
|
if (!axp.begin(Wire, AXP192_SLAVE_ADDRESS)) {
|
||||||
batteryLevel = &axp;
|
batteryLevel = &axp;
|
||||||
|
@ -110,7 +110,7 @@ void scanI2Cdevice(void)
|
|||||||
screen_found = addr;
|
screen_found = addr;
|
||||||
DEBUG_MSG("st7567 display found\n");
|
DEBUG_MSG("st7567 display found\n");
|
||||||
}
|
}
|
||||||
#ifdef AXP192_SLAVE_ADDRESS
|
#ifdef HAS_AXP192
|
||||||
if (addr == AXP192_SLAVE_ADDRESS) {
|
if (addr == AXP192_SLAVE_ADDRESS) {
|
||||||
axp192_found = true;
|
axp192_found = true;
|
||||||
DEBUG_MSG("axp192 PMU found\n");
|
DEBUG_MSG("axp192 PMU found\n");
|
||||||
|
@ -307,7 +307,7 @@ void setup()
|
|||||||
setupModules();
|
setupModules();
|
||||||
|
|
||||||
// Do this after service.init (because that clears error_code)
|
// Do this after service.init (because that clears error_code)
|
||||||
#ifdef AXP192_SLAVE_ADDRESS
|
#ifdef HAS_AXP192
|
||||||
if (!axp192_found)
|
if (!axp192_found)
|
||||||
RECORD_CRITICALERROR(CriticalErrorCode_NoAXP192); // Record a hardware fault for missing hardware
|
RECORD_CRITICALERROR(CriticalErrorCode_NoAXP192); // Record a hardware fault for missing hardware
|
||||||
#endif
|
#endif
|
||||||
|
@ -35,7 +35,7 @@ void powerCommandsCheck()
|
|||||||
|
|
||||||
if (shutdownAtMsec && millis() > shutdownAtMsec) {
|
if (shutdownAtMsec && millis() > shutdownAtMsec) {
|
||||||
DEBUG_MSG("Shutting down from admin command\n");
|
DEBUG_MSG("Shutting down from admin command\n");
|
||||||
#ifdef TBEAM_V10
|
#ifdef HAS_AXP192
|
||||||
if (axp192_found == true) {
|
if (axp192_found == true) {
|
||||||
playShutdownMelody();
|
playShutdownMelody();
|
||||||
power->shutdown();
|
power->shutdown();
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
esp_sleep_source_t wakeCause; // the reason we booted this time
|
esp_sleep_source_t wakeCause; // the reason we booted this time
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TBEAM_V10
|
#ifdef HAS_AXP192
|
||||||
#include "axp20x.h"
|
#include "axp20x.h"
|
||||||
extern AXP20X_Class axp;
|
extern AXP20X_Class axp;
|
||||||
#endif
|
#endif
|
||||||
@ -80,7 +80,7 @@ void setLed(bool ledOn)
|
|||||||
digitalWrite(LED_PIN, ledOn ^ LED_INVERTED);
|
digitalWrite(LED_PIN, ledOn ^ LED_INVERTED);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TBEAM_V10
|
#ifdef HAS_AXP192
|
||||||
if (axp192_found) {
|
if (axp192_found) {
|
||||||
// blink the axp led
|
// blink the axp led
|
||||||
axp.setChgLEDMode(ledOn ? AXP20X_LED_LOW_LEVEL : AXP20X_LED_OFF);
|
axp.setChgLEDMode(ledOn ? AXP20X_LED_LOW_LEVEL : AXP20X_LED_OFF);
|
||||||
@ -92,7 +92,7 @@ void setGPSPower(bool on)
|
|||||||
{
|
{
|
||||||
DEBUG_MSG("Setting GPS power=%d\n", on);
|
DEBUG_MSG("Setting GPS power=%d\n", on);
|
||||||
|
|
||||||
#ifdef TBEAM_V10
|
#ifdef HAS_AXP192
|
||||||
if (axp192_found)
|
if (axp192_found)
|
||||||
axp.setPowerOutPut(AXP192_LDO3, on ? AXP202_ON : AXP202_OFF); // GPS main power
|
axp.setPowerOutPut(AXP192_LDO3, on ? AXP202_ON : AXP202_OFF); // GPS main power
|
||||||
#endif
|
#endif
|
||||||
@ -187,7 +187,7 @@ void doDeepSleep(uint64_t msecToWake)
|
|||||||
digitalWrite(VEXT_ENABLE, 1); // turn off the display power
|
digitalWrite(VEXT_ENABLE, 1); // turn off the display power
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TBEAM_V10
|
#ifdef HAS_AXP192
|
||||||
if (axp192_found) {
|
if (axp192_found) {
|
||||||
// Obsolete comment: from back when we we used to receive lora packets while CPU was in deep sleep.
|
// Obsolete comment: from back when we we used to receive lora packets while CPU was in deep sleep.
|
||||||
// We no longer do that, because our light-sleep current draws are low enough and it provides fast start/low cost
|
// We no longer do that, because our light-sleep current draws are low enough and it provides fast start/low cost
|
||||||
|
@ -34,4 +34,4 @@
|
|||||||
// Leave undefined to disable our PMU IRQ handler. DO NOT ENABLE THIS because the pmuirq can cause sperious interrupts
|
// Leave undefined to disable our PMU IRQ handler. DO NOT ENABLE THIS because the pmuirq can cause sperious interrupts
|
||||||
// and waking from light sleep
|
// and waking from light sleep
|
||||||
// #define PMU_IRQ 35
|
// #define PMU_IRQ 35
|
||||||
#define AXP192_SLAVE_ADDRESS 0x34
|
#define HAS_AXP192
|
Loading…
Reference in New Issue
Block a user