Skip to content

Commit

Permalink
Workflow and various fixes (#62)
Browse files Browse the repository at this point in the history
* Remove dependence on Battery Sense library, use M5Unified.

* Restore build version envvar in workflow.

* Refactor pio configuration.

* Add TinyGPSPlus to README.
  • Loading branch information
gkoh authored Feb 28, 2024
1 parent 2eeac47 commit 414ed3e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 29 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
tags:
- 'v*'

env:
FURBLE_VERSION: ${{ github.ref_name }}+${{ github.run_attempt }}

jobs:
build:

Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
15 changes: 3 additions & 12 deletions lib/M5ez/src/M5ez.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ extern "C" {
#endif // M5EZ_WIFI

#ifdef M5EZ_BATTERY
#include <Battery.h>
#endif

#ifdef M5EZ_CLOCK
Expand Down Expand Up @@ -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
Expand Down
17 changes: 4 additions & 13 deletions platformio.ini
Original file line number Diff line number Diff line change
@@ -1,37 +1,28 @@
[furble]
build_flags = -D FURBLE_VERSION=\"${sysenv.FURBLE_VERSION}\"
lib_deps =
[email protected]
Battery Sense
[email protected]
mikalhart/[email protected]

[env]
platform = espressif32
board_build.f_cpu = 80000000L
upload_protocol = esptool
framework = arduino
lib_deps =
[email protected]
[email protected]
mikalhart/[email protected]

[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}

0 comments on commit 414ed3e

Please sign in to comment.