Add adafruit-huzzah32 firmware flavor

This commit is contained in:
DTTerastar 2021-09-25 10:46:19 -04:00
parent e5f08f1b9b
commit b9876c5834
4 changed files with 22 additions and 18 deletions

View File

@ -30,11 +30,12 @@ jobs:
run: echo "PLATFORMIO_BUILD_FLAGS=-DVERSION='\"${GITHUB_REF#refs/*/}\"'" >> $GITHUB_ENV
if: startsWith(github.ref, 'refs/tags/')
- name: Run PlatformIO
run: pio run -e esp32 -e esp32-verbose -e m5stickc -e m5stickc-plus -e m5atom-matrix -e macchina-a0
run: pio run -e esp32 -e esp32-verbose -e adafruit-huzzah32 -e m5stickc -e m5stickc-plus -e m5atom-matrix -e macchina-a0
- name: Rename firmware
run: |
cp .pio/build/esp32/firmware.bin esp32.bin
cp .pio/build/esp32-verbose/firmware.bin esp32-verbose.bin
cp .pio/build/adafruit-huzzah32/firmware.bin adafruit-huzzah32.bin
cp .pio/build/m5stickc/firmware.bin m5stickc.bin
cp .pio/build/m5stickc-plus/firmware.bin m5stickc-plus.bin
cp .pio/build/m5atom-matrix/firmware.bin m5atom-matrix.bin

View File

@ -1,6 +1,21 @@
#include "BleFingerprint.h"
#include "util.h"
#define Sprintf(f, ...) ( \
{ \
char *s; \
asprintf(&s, f, __VA_ARGS__); \
String r = s; \
free(s); \
r; \
})
#define SMacf(f) ( \
{ \
auto nativeAddress = f.getNative(); \
Sprintf("%02x%02x%02x%02x%02x%02x", nativeAddress[5], nativeAddress[4], nativeAddress[3], nativeAddress[2], nativeAddress[1], nativeAddress[0]); \
})
static std::string hexStr(const char *data, int len)
{
constexpr char hexmap[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
@ -19,6 +34,8 @@ static std::string hexStr(std::string s)
return hexStr(s.c_str(), s.length());
}
String BleFingerprint::getMac() { return SMacf(address); }
BleFingerprint::BleFingerprint(BLEAdvertisedDevice *advertisedDevice, float fcmin, float beta, float dcutoff) : oneEuro{one_euro_filter<double, unsigned long>(1, fcmin, beta, dcutoff)}
{
if (advertisedDevice->getAddressType() == BLE_ADDR_PUBLIC)

View File

@ -17,20 +17,6 @@ static const int defaultTxPower = TX_DEFAULT;
static const int defaultTxPower = -59;
#endif
#define Sprintf(f, ...) ( \
{ \
char *s; \
asprintf(&s, f, __VA_ARGS__); \
String r = s; \
free(s); \
r; \
})
#define SMacf(f) ( \
{ \
auto nativeAddress = f.getNative(); \
Sprintf("%02x%02x%02x%02x%02x%02x", nativeAddress[5], nativeAddress[4], nativeAddress[3], nativeAddress[2], nativeAddress[1], nativeAddress[0]); \
})
class BleFingerprint
{
@ -47,7 +33,7 @@ public:
if (!sid.isEmpty()) return sid;
return getMac();
}
String getMac() { return SMacf(address); }
String getMac();
int get1mRssi()
{
if (calRssi != NO_RSSI) return calRssi;

View File

@ -32,7 +32,7 @@ monitor_filters = esp32_exception_decoder
build_flags =
-D FIRMWARE='"esp32"'
[env:esp32-huzzah32]
[env:adafruit-huzzah32]
platform = espressif32
framework = arduino
board = esp32dev
@ -41,7 +41,7 @@ board_build.partitions = partitions_singleapp.csv
monitor_speed = 115200
monitor_filters = esp32_exception_decoder
build_flags =
-D FIRMWARE='"esp32-huzzah32"'
-D FIRMWARE='"adafruit-huzzah32"'
-D HUZZAH32
[env:esp32-verbose]