general both build types

pull/29/head
geeksville 2020-02-14 14:00:08 -08:00
rodzic 6edce4ae69
commit 52b398083a
6 zmienionych plików z 35 dodań i 26 usunięć

13
build-all.sh 100755
Wyświetl plik

@ -0,0 +1,13 @@
set -e
VERSION=0.0.2
rm .pio/build/esp32/firmware.bin
export PLATFORMIO_BUILD_FLAGS="-DT_BEAM_V10 -DAPP_VERSION=$VERSION"
pio run # -v
cp .pio/build/esp32/firmware.bin release/firmware-TBEAM-US.bin
rm .pio/build/esp32/firmware.bin
export PLATFORMIO_BUILD_FLAGS="-DHELTEC_LORA32 -DAPP_VERSION=$VERSION"
pio run # -v
cp .pio/build/esp32/firmware.bin release/firmware-HELTEC-US.bin

Wyświetl plik

@ -15,7 +15,7 @@ static BLECharacteristic HardwareVersionCharacteristic(BLEUUID((uint16_t)ESP_GAT
/** /**
* Create standard device info service * Create standard device info service
**/ **/
BLEService *createDeviceInfomationService(BLEServer *server, std::string hwVendor, std::string swVersion) BLEService *createDeviceInfomationService(BLEServer *server, std::string hwVendor, std::string swVersion, std::string hwVersion)
{ {
BLEService *deviceInfoService = server->createService(BLEUUID((uint16_t)ESP_GATT_UUID_DEVICE_INFO_SVC)); BLEService *deviceInfoService = server->createService(BLEUUID((uint16_t)ESP_GATT_UUID_DEVICE_INFO_SVC));
@ -32,7 +32,7 @@ BLEService *createDeviceInfomationService(BLEServer *server, std::string hwVendo
deviceInfoService->addCharacteristic(&SWVersionCharacteristic); deviceInfoService->addCharacteristic(&SWVersionCharacteristic);
ManufacturerCharacteristic.setValue(hwVendor); ManufacturerCharacteristic.setValue(hwVendor);
deviceInfoService->addCharacteristic(&ManufacturerCharacteristic); deviceInfoService->addCharacteristic(&ManufacturerCharacteristic);
HardwareVersionCharacteristic.setValue("1.0"); HardwareVersionCharacteristic.setValue(hwVersion);
deviceInfoService->addCharacteristic(&HardwareVersionCharacteristic); deviceInfoService->addCharacteristic(&HardwareVersionCharacteristic);
//SerialNumberCharacteristic.setValue("FIXME"); //SerialNumberCharacteristic.setValue("FIXME");
//deviceInfoService->addCharacteristic(&SerialNumberCharacteristic); //deviceInfoService->addCharacteristic(&SerialNumberCharacteristic);
@ -179,7 +179,7 @@ class MySecurity : public BLESecurityCallbacks
} }
}; };
BLEServer *initBLE(std::string deviceName, std::string hwVendor, std::string swVersion) BLEServer *initBLE(std::string deviceName, std::string hwVendor, std::string swVersion, std::string hwVersion)
{ {
BLEDevice::init(deviceName); BLEDevice::init(deviceName);
BLEDevice::setEncryptionLevel(ESP_BLE_SEC_ENCRYPT); BLEDevice::setEncryptionLevel(ESP_BLE_SEC_ENCRYPT);
@ -193,7 +193,7 @@ BLEServer *initBLE(std::string deviceName, std::string hwVendor, std::string swV
BLEServer *pServer = BLEDevice::createServer(); BLEServer *pServer = BLEDevice::createServer();
pServer->setCallbacks(new MyServerCallbacks()); pServer->setCallbacks(new MyServerCallbacks());
BLEService *pDevInfo = createDeviceInfomationService(pServer, hwVendor, swVersion); BLEService *pDevInfo = createDeviceInfomationService(pServer, hwVendor, swVersion, hwVersion);
// We now let users create the battery service only if they really want (not all devices have a battery) // We now let users create the battery service only if they really want (not all devices have a battery)
// BLEService *pBattery = createBatteryService(pServer); // BLEService *pBattery = createBatteryService(pServer);
@ -210,7 +210,6 @@ BLEServer *initBLE(std::string deviceName, std::string hwVendor, std::string swV
// FIXME turn on this restriction only after the device is paired with a phone // FIXME turn on this restriction only after the device is paired with a phone
// advert->setScanFilter(false, true); // We let anyone scan for us (FIXME, perhaps only allow that until we are paired with a phone and configured) but only let whitelist phones connect // advert->setScanFilter(false, true); // We let anyone scan for us (FIXME, perhaps only allow that until we are paired with a phone and configured) but only let whitelist phones connect
BLESecurity *pSecurity = new BLESecurity(); BLESecurity *pSecurity = new BLESecurity();
pSecurity->setCapability(ESP_IO_CAP_OUT); pSecurity->setCapability(ESP_IO_CAP_OUT);
pSecurity->setAuthenticationMode(ESP_LE_AUTH_REQ_SC_BOND); pSecurity->setAuthenticationMode(ESP_LE_AUTH_REQ_SC_BOND);

Wyświetl plik

@ -18,4 +18,4 @@ void dumpCharacteristic(BLECharacteristic *c);
uint32_t getValue32(BLECharacteristic *c, uint32_t defaultValue); uint32_t getValue32(BLECharacteristic *c, uint32_t defaultValue);
void loopBLE(); void loopBLE();
BLEServer *initBLE(std::string devName, std::string hwVendor, std::string swVersion); BLEServer *initBLE(std::string devName, std::string hwVendor, std::string swVersion, std::string hwVersion);

1
release/.gitignore vendored 100644
Wyświetl plik

@ -0,0 +1 @@
*.bin

Wyświetl plik

@ -30,20 +30,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#define APP_NAME "Meshtastic" #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 // Configuration
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Select which T-Beam board is being used. Only uncomment one. Note: these options now come from platformio standard build file flags // Select which board is being used. If the outside build environment has sent a choice, just use that
//#ifdef ARDUINO_T_Beam #if !defined(T_BEAM_V10) && !defined(HELTEC_LORA32)
//#define T_BEAM_V10 // AKA Rev1 (second board released) #define T_BEAM_V10 // AKA Rev1 (second board released)
//#endif //#define HELTEC_LORA32
#endif
//#ifdef ARDUINO_HELTEC_WIFI_LORA_32_V2
#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) // 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 // we don't support jtag on the ttgo - access to gpio 12 is a PITA

Wyświetl plik

@ -39,6 +39,7 @@ AXP20X_Class axp;
bool pmu_irq = false; bool pmu_irq = false;
#endif #endif
bool isCharging = false; bool isCharging = false;
bool isUSBPowered = false;
bool ssd1306_found = false; bool ssd1306_found = false;
bool axp192_found = false; bool axp192_found = false;
@ -282,6 +283,7 @@ void axp192Init()
#endif #endif
isCharging = axp.isChargeing(); isCharging = axp.isChargeing();
isUSBPowered = axp.isVBUSPlug();
} }
else else
{ {
@ -380,7 +382,7 @@ void setup()
if (useBluetooth) if (useBluetooth)
{ {
DEBUG_MSG("Starting bluetooth\n"); 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); createMeshBluetoothService(serve);
// Start advertising - this must be done _after_ creating all services // Start advertising - this must be done _after_ creating all services
@ -420,16 +422,10 @@ void loop()
{ {
pmu_irq = false; pmu_irq = false;
axp.readIRQ(); axp.readIRQ();
isCharging = axp.isChargingIRQ();
if (axp.isVbusRemoveIRQ()) isCharging = axp.isChargeing();
isCharging = false; 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 #endif
@ -478,7 +474,7 @@ void loop()
#ifdef MINWAKE_MSECS #ifdef MINWAKE_MSECS
// Don't deepsleep if we have USB power or if the user as pressed a button recently // 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(); sleep();
} }