moving build selection into platformio.ini rather than nasty #defines. thanks to @sensorslot

for the pointer to https://github.com/arendst/Tasmota - where I just borrowed heavily ;-)
This commit is contained in:
geeksville
2020-03-27 14:03:58 -07:00
parent 5c4ae6c042
commit d831beab3d
7 changed files with 53 additions and 46 deletions
+7 -6
View File
@@ -40,9 +40,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// -----------------------------------------------------------------------------
// 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
#if !defined(ARDUINO_T_Beam) && !defined(ARDUINO_HELTEC_WIFI_LORA_32_V2)
// The platformio build environment should set this now
// #define ARDUINO_T_Beam // AKA Rev1 (second board released)
// #define ARDUINO_HELTEC_WIFI_LORA_32_V2
#define HW_VERSION_US // We encode the hardware freq range in the hw version string, so sw update can eventually install the
// correct build
@@ -50,7 +51,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// 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
#ifdef HELTEC_LORA32
#ifdef ARDUINO_HELTEC_WIFI_LORA_32_V2
//#define USE_JTAG
#endif
@@ -105,7 +106,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MOSI_GPIO 27
#define NSS_GPIO 18
#if defined(T_BEAM_V10)
#if defined(ARDUINO_T_Beam)
// This string must exactly match the case used in release file names or the android updater won't work
#define HW_VENDOR "TBEAM"
@@ -126,7 +127,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Leave undefined to disable our PMU IRQ handler
#define PMU_IRQ 35
#elif defined(HELTEC_LORA32)
#elif defined(ARDUINO_HELTEC_WIFI_LORA_32_V2)
// This string must exactly match the case used in release file names or the android updater won't work
#define HW_VENDOR "HELTEC"
+3 -3
View File
@@ -38,7 +38,7 @@
#include <Wire.h>
#include <driver/rtc_io.h>
#ifdef T_BEAM_V10
#ifdef ARDUINO_T_Beam
#include "axp20x.h"
AXP20X_Class axp;
bool pmu_irq = false;
@@ -81,7 +81,7 @@ void scanI2Cdevice(void)
ssd1306_found = true;
DEBUG_MSG("ssd1306 display found\n");
}
#ifdef T_BEAM_V10
#ifdef ARDUINO_T_Beam
if (addr == AXP192_SLAVE_ADDRESS) {
axp192_found = true;
DEBUG_MSG("axp192 PMU found\n");
@@ -108,7 +108,7 @@ void scanI2Cdevice(void)
*/
void axp192Init()
{
#ifdef T_BEAM_V10
#ifdef ARDUINO_T_Beam
if (axp192_found) {
if (!axp.begin(Wire, AXP192_SLAVE_ADDRESS)) {
DEBUG_MSG("AXP192 Begin PASS\n");
+4 -4
View File
@@ -14,7 +14,7 @@
#include <Wire.h>
#include <driver/rtc_io.h>
#ifdef T_BEAM_V10
#ifdef ARDUINO_T_Beam
#include "axp20x.h"
extern AXP20X_Class axp;
#endif
@@ -48,7 +48,7 @@ void setLed(bool ledOn)
digitalWrite(LED_PIN, ledOn);
#endif
#ifdef T_BEAM_V10
#ifdef ARDUINO_T_Beam
if (axp192_found) {
// blink the axp led
axp.setChgLEDMode(ledOn ? AXP20X_LED_LOW_LEVEL : AXP20X_LED_OFF);
@@ -60,7 +60,7 @@ void setGPSPower(bool on)
{
DEBUG_MSG("Setting GPS power=%d\n", on);
#ifdef T_BEAM_V10
#ifdef ARDUINO_T_Beam
if (axp192_found)
axp.setPowerOutPut(AXP192_LDO3, on ? AXP202_ON : AXP202_OFF); // GPS main power
#endif
@@ -124,7 +124,7 @@ void doDeepSleep(uint64_t msecToWake)
setLed(false);
#ifdef T_BEAM_V10
#ifdef ARDUINO_T_Beam
if (axp192_found) {
// No need to turn this off if the power draw in sleep mode really is just 0.2uA and turning it off would
// leave floating input for the IRQ line