mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-16 14:57:41 +00:00
I thought git would be smart enough to understand all the whitespace changes but even with all the flags I know to make it ignore theses it still blows up if there are identical changes on both sides.
I have a solution but it require creating a new commit at the merge base for each conflicting PR and merging it into develop.
I don't think blowing up all PRs is worth for now, maybe if we can coordinate this for V3 let's say.
This reverts commit 0d11331d18.
66 lines
1.6 KiB
C++
66 lines
1.6 KiB
C++
#include "Led.h"
|
|
#include "PowerMon.h"
|
|
#include "main.h"
|
|
#include "power.h"
|
|
|
|
GpioVirtPin ledForceOn, ledBlink;
|
|
|
|
#if defined(LED_PIN)
|
|
// Most boards have a GPIO for LED control
|
|
static GpioHwPin ledRawHwPin(LED_PIN);
|
|
#else
|
|
static GpioVirtPin ledRawHwPin; // Dummy pin for no hardware
|
|
#endif
|
|
|
|
#if LED_STATE_ON == 0
|
|
static GpioVirtPin ledHwPin;
|
|
static GpioNotTransformer ledInverter(&ledHwPin, &ledRawHwPin);
|
|
#else
|
|
static GpioPin &ledHwPin = ledRawHwPin;
|
|
#endif
|
|
|
|
#if defined(HAS_PMU)
|
|
/**
|
|
* A GPIO controlled by the PMU
|
|
*/
|
|
class GpioPmuPin : public GpioPin
|
|
{
|
|
public:
|
|
void set(bool value)
|
|
{
|
|
if (pmu_found && PMU) {
|
|
// blink the axp led
|
|
PMU->setChargingLedMode(value ? XPOWERS_CHG_LED_ON : XPOWERS_CHG_LED_OFF);
|
|
}
|
|
}
|
|
} ledPmuHwPin;
|
|
|
|
// In some cases we need to drive a PMU LED and a normal LED
|
|
static GpioSplitter ledFinalPin(&ledHwPin, &ledPmuHwPin);
|
|
#else
|
|
static GpioPin &ledFinalPin = ledHwPin;
|
|
#endif
|
|
|
|
#ifdef USE_POWERMON
|
|
/**
|
|
* We monitor changes to the LED drive output because we use that as a sanity test in our power monitor stuff.
|
|
*/
|
|
class MonitoredLedPin : public GpioPin
|
|
{
|
|
public:
|
|
void set(bool value)
|
|
{
|
|
if (powerMon) {
|
|
if (value)
|
|
powerMon->setState(meshtastic_PowerMon_State_LED_On);
|
|
else
|
|
powerMon->clearState(meshtastic_PowerMon_State_LED_On);
|
|
}
|
|
ledFinalPin.set(value);
|
|
}
|
|
} monitoredLedPin;
|
|
#else
|
|
static GpioPin &monitoredLedPin = ledFinalPin;
|
|
#endif
|
|
|
|
static GpioBinaryTransformer ledForcer(&ledForceOn, &ledBlink, &monitoredLedPin, GpioBinaryTransformer::Or); |