Skip to content

Commit 85125b7

Browse files
committed
Added X charge indicator on loading screen and fake battery support
1 parent 73f0734 commit 85125b7

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

src/api-client/display.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,19 @@ const char *szMakers[] = {"None", "ASAIR", "Bosch", "Bosch", "Bosch", "Sensirion
1313

1414
void addHeaders(HTTPClient &https, ApiDisplayInputs &inputs)
1515
{
16+
#if defined( FAKE_BATTERY_VOLTAGE ) && defined (BOARD_TRMNL_X)
17+
// Create fake values that satisfy the server
18+
inputs.batteryCharging = 0;
19+
inputs.batteryCount = 1;
20+
inputs.stateOfCharge = 75;
21+
inputs.stateOfHealth = 75;
22+
inputs.batteryCurrent = 3000;
23+
inputs.batteryTemperature = 25;
24+
inputs.currentBatteryCapacity = 3000;
25+
inputs.maxBatteryCapacity = 4000;
26+
inputs.batteryVoltage = 4.2f;
27+
#endif // FAKE_BATTERY_VOLTAGE
28+
1629
Log_info("Added headers:\n\r"
1730
"ID: %s\n\r"
1831
"Special function: %d\n\r"

src/battery_small.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//
2+
// Created with imageconvert, written by Larry Bank
3+
// 124 x 74 x 1-bit per pixel
4+
// compressed image data size = 99 bytes
5+
//
6+
const uint8_t battery_small[] = {
7+
0xbf,0xbb,0x7c,0x00,0x4a,0x00,0x5b,0x00,0xf3,0x41,0x35,0xa5,0xeb,0xeb,0x59,0x7b,
8+
0x0c,0xad,0x55,0x56,0x1d,0x25,0xfd,0x5d,0x16,0xb0,0x99,0x65,0xff,0xd7,0xeb,0xff,
9+
0xeb,0xff,0xe9,0x7d,0x7f,0xfd,0x7e,0xb3,0x09,0xff,0x0f,0xaf,0xfb,0xeb,0xf4,0xbf,
10+
0xfd,0x7e,0xbf,0xc9,0x77,0xd0,0xfe,0x75,0xc4,0x7f,0x5f,0xff,0x5f,0xff,0x5f,0x4b,
11+
0xfd,0x7a,0xaf,0x52,0xd1,0x7f,0xfa,0xff,0xfa,0xfd,0x7d,0x7f,0x5f,0xaf,0xff,0xaf,
12+
0x32,0xd9,0x2c,0x63,0x7a,0x4b,0xd7,0x75,0x4a,0x1e,0xa1,0x46,0x87,0xeb,0xeb,0x55,
13+
0xd4,0x78,0x00};

src/display.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "driver/gpio.h"
1111
#include "driver/rtc_io.h"
1212
#include "LittleFS.h"
13+
#include "battery_small.h"
1314
#define FS LittleFS
1415
#endif
1516
#define MAX_BIT_DEPTH 8
@@ -1205,6 +1206,12 @@ void display_show_image(uint8_t *image_buffer, int data_size, bool bWait)
12051206
bbep.fillScreen(BBEP_WHITE);
12061207
}
12071208
bbep.loadG5Image(image_buffer, x, y, BBEP_WHITE, BBEP_BLACK);
1209+
#ifdef BOARD_TRMNL_X
1210+
// Show charging indicator if it's charging
1211+
if (is_charging()) {
1212+
bbep.loadG5Image(battery_small, 40, bbep.height() - 120, BBEP_WHITE, BBEP_BLACK);
1213+
}
1214+
#endif // BOARD_TRMNL_X
12081215
}
12091216
else
12101217
{

0 commit comments

Comments
 (0)