mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-09 03:17:31 +00:00
general both build types
This commit is contained in:
@@ -30,20 +30,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#define APP_NAME "Meshtastic"
|
||||
#define APP_VERSION "0.0.1"
|
||||
#ifndef APP_VERSION
|
||||
#define APP_VERSION "0.0.0"
|
||||
#endif
|
||||
#define HW_VERSION "US" // We encode the hardware freq range in the hw version string, so sw update can eventually install the correct build
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Configuration
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// Select which T-Beam board is being used. Only uncomment one. Note: these options now come from platformio standard build file flags
|
||||
//#ifdef ARDUINO_T_Beam
|
||||
//#define T_BEAM_V10 // AKA Rev1 (second board released)
|
||||
//#endif
|
||||
|
||||
//#ifdef ARDUINO_HELTEC_WIFI_LORA_32_V2
|
||||
#define HELTEC_LORA32
|
||||
//#endif
|
||||
// Select which board is being used. If the outside build environment has sent a choice, just use that
|
||||
#if !defined(T_BEAM_V10) && !defined(HELTEC_LORA32)
|
||||
#define T_BEAM_V10 // AKA Rev1 (second board released)
|
||||
//#define HELTEC_LORA32
|
||||
#endif
|
||||
|
||||
// If we are using the JTAG port for debugging, some pins must be left free for that (and things like GPS have to be disabled)
|
||||
// we don't support jtag on the ttgo - access to gpio 12 is a PITA
|
||||
|
||||
18
src/main.ino
18
src/main.ino
@@ -39,6 +39,7 @@ AXP20X_Class axp;
|
||||
bool pmu_irq = false;
|
||||
#endif
|
||||
bool isCharging = false;
|
||||
bool isUSBPowered = false;
|
||||
|
||||
bool ssd1306_found = false;
|
||||
bool axp192_found = false;
|
||||
@@ -282,6 +283,7 @@ void axp192Init()
|
||||
#endif
|
||||
|
||||
isCharging = axp.isChargeing();
|
||||
isUSBPowered = axp.isVBUSPlug();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -380,7 +382,7 @@ void setup()
|
||||
if (useBluetooth)
|
||||
{
|
||||
DEBUG_MSG("Starting bluetooth\n");
|
||||
BLEServer *serve = initBLE(getDeviceName(), HW_VENDOR, APP_VERSION); // FIXME, use a real name based on the macaddr
|
||||
BLEServer *serve = initBLE(getDeviceName(), HW_VENDOR, APP_VERSION, HW_VERSION); // FIXME, use a real name based on the macaddr
|
||||
createMeshBluetoothService(serve);
|
||||
|
||||
// Start advertising - this must be done _after_ creating all services
|
||||
@@ -420,17 +422,11 @@ void loop()
|
||||
{
|
||||
pmu_irq = false;
|
||||
axp.readIRQ();
|
||||
isCharging = axp.isChargingIRQ();
|
||||
|
||||
if (axp.isVbusRemoveIRQ())
|
||||
isCharging = false;
|
||||
isCharging = axp.isChargeing();
|
||||
isUSBPowered = axp.isVBUSPlug();
|
||||
|
||||
if (axp.isAcinPlugInIRQ())
|
||||
fixme - cleanup all this is chrarging crap.just read the status registers then clear the irq
|
||||
isUSBPowered = true
|
||||
// This is not a GPIO actually connected on the tbeam board
|
||||
// digitalWrite(2, !digitalRead(2));
|
||||
axp.clearIRQ();
|
||||
axp.clearIRQ();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -478,7 +474,7 @@ void loop()
|
||||
|
||||
#ifdef MINWAKE_MSECS
|
||||
// Don't deepsleep if we have USB power or if the user as pressed a button recently
|
||||
if (millis() - lastPressMs > MINWAKE_MSECS && !isCharging)
|
||||
if (millis() - lastPressMs > MINWAKE_MSECS && !isUSBPowered)
|
||||
{
|
||||
sleep();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user