diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7f0d8cc..777ac24 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,6 +5,9 @@ on: tags: - 'v*' +env: + FURBLE_VERSION: ${{ github.ref_name }}+${{ github.run_attempt }} + jobs: build: diff --git a/README.md b/README.md index 72007ad..4bfafa6 100644 --- a/README.md +++ b/README.md @@ -101,13 +101,11 @@ The M5StickC Plus sells for US$19.95. The project is built with [PlatformIO](https://platformio.org) and depends on the following libraries: -- [Battery Sense](https://github.com/rlogiacco/BatterySense) - - only the voltage to capacity function is used - [M5ez](https://github.com/M5ez/M5ez) - severely butchered version to work on the M5StickC -- [M5StickC](https://github.com/m5stack/M5StickC) -- [M5StickC Plus](https://github.com/m5stack/M5StickC-Plus) +- [M5Unified](https://github.com/m5stack/M5Unified) - [NimBLE-Arduino](https://github.com/h2zero/NimBLE-Arduino) +- [TinyGPSPlus](https://github.com/mikalhart/TinyGPSPlus) ## Installation diff --git a/lib/M5ez/src/M5ez.cpp b/lib/M5ez/src/M5ez.cpp index 2ab6695..1b904d4 100644 --- a/lib/M5ez/src/M5ez.cpp +++ b/lib/M5ez/src/M5ez.cpp @@ -13,7 +13,6 @@ extern "C" { #endif // M5EZ_WIFI #ifdef M5EZ_BATTERY -#include #endif #ifdef M5EZ_CLOCK @@ -2120,17 +2119,9 @@ uint16_t ezBattery::loop() { // Transform the M5Stack built in battery level into an internal format. // From [100, 75, 50, 25, 0] to [4, 3, 2, 1, 0] uint8_t ezBattery::getTransformedBatteryLevel() { - uint8_t level = sigmoidal(M5.Power.getBatteryVoltage(), 3000, 4200); - if (level > 80) - return 4; - else if (level > 60) - return 3; - else if (level > 40) - return 2; - else if (level > 20) - return 1; - else - return 0; + int32_t level = M5.Power.getBatteryLevel(); + + return map(level, 0, 100, 0, 4); } // Return the theme based battery bar color according to its level diff --git a/platformio.ini b/platformio.ini index 3c36c39..805aeb2 100644 --- a/platformio.ini +++ b/platformio.ini @@ -1,37 +1,28 @@ [furble] build_flags = -D FURBLE_VERSION=\"${sysenv.FURBLE_VERSION}\" -lib_deps = - M5Unified@0.1.12 - Battery Sense - NimBLE-Arduino@1.4.1 - mikalhart/TinyGPSPlus@1.0.3 [env] platform = espressif32 board_build.f_cpu = 80000000L upload_protocol = esptool framework = arduino +lib_deps = + M5Unified@0.1.12 + NimBLE-Arduino@1.4.1 + mikalhart/TinyGPSPlus@1.0.3 [env:m5stick-c] board = m5stick-c build_flags = ${furble.build_flags} -D M5STICKC -lib_deps = - ${furble.lib_deps} [env:m5stick-c-plus] board = m5stick-c build_flags = ${furble.build_flags} -D M5STICKC_PLUS -lib_deps = - ${furble.lib_deps} [env:m5stack-core] board = m5stack-core-esp32 build_flags = ${furble.build_flags} -D M5STACK_CORE2 -lib_deps = - ${furble.lib_deps} [env:m5stack-core2] board = m5stack-core2 build_flags = ${furble.build_flags} -D M5STACK_CORE2 -lib_deps = - ${furble.lib_deps}