general both build types

1.2-legacy
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
**/
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));
@ -32,7 +32,7 @@ BLEService *createDeviceInfomationService(BLEServer *server, std::string hwVendo
deviceInfoService->addCharacteristic(&SWVersionCharacteristic);
ManufacturerCharacteristic.setValue(hwVendor);
deviceInfoService->addCharacteristic(&ManufacturerCharacteristic);
HardwareVersionCharacteristic.setValue("1.0");
HardwareVersionCharacteristic.setValue(hwVersion);
deviceInfoService->addCharacteristic(&HardwareVersionCharacteristic);
//SerialNumberCharacteristic.setValue("FIXME");
//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::setEncryptionLevel(ESP_BLE_SEC_ENCRYPT);
@ -193,7 +193,7 @@ BLEServer *initBLE(std::string deviceName, std::string hwVendor, std::string swV
BLEServer *pServer = BLEDevice::createServer();
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)
// 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
// 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();
pSecurity->setCapability(ESP_IO_CAP_OUT);
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);
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_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

Wyświetl plik

@ -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,16 +422,10 @@ 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();
}
#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();
}