Add multiple battery level icons
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 9.9 KiB |
|
@ -0,0 +1,11 @@
|
||||||
|
static const unsigned char battery_0[513] PROGMEM = {
|
||||||
|
// 'battery_0', 32x32px
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xf8, 0x1f, 0xff,
|
||||||
|
0xff, 0x00, 0x00, 0xff, 0xfe, 0x00, 0x00, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f,
|
||||||
|
0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f,
|
||||||
|
0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f,
|
||||||
|
0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f,
|
||||||
|
0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f,
|
||||||
|
0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f,
|
||||||
|
0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff
|
||||||
|
};
|
|
@ -0,0 +1,12 @@
|
||||||
|
static const unsigned char battery_100[513] PROGMEM = {
|
||||||
|
// 'catnip', 32x32px
|
||||||
|
// 'battery_100', 32x32px
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xf0, 0x1f, 0xff,
|
||||||
|
0xfe, 0x00, 0x00, 0xff, 0xfc, 0x00, 0x00, 0xff, 0xfc, 0x7f, 0xfc, 0xff, 0xfc, 0x7f, 0xfc, 0xff,
|
||||||
|
0xfc, 0x40, 0x04, 0xff, 0xfc, 0x40, 0x04, 0xff, 0xfc, 0x40, 0x04, 0xff, 0xfc, 0x7f, 0xfc, 0xff,
|
||||||
|
0xfc, 0x7f, 0xfc, 0xff, 0xfc, 0x40, 0x04, 0xff, 0xfc, 0x40, 0x04, 0xff, 0xfc, 0x40, 0x04, 0xff,
|
||||||
|
0xfc, 0x40, 0x04, 0xff, 0xfc, 0x7f, 0xfc, 0xff, 0xfc, 0x40, 0x04, 0xff, 0xfc, 0x40, 0x04, 0xff,
|
||||||
|
0xfc, 0x40, 0x04, 0xff, 0xfc, 0x40, 0x04, 0xff, 0xfc, 0x7f, 0xfc, 0xff, 0xfc, 0x40, 0x0c, 0xff,
|
||||||
|
0xfc, 0x40, 0x04, 0xff, 0xfc, 0x40, 0x04, 0xff, 0xfc, 0x40, 0x04, 0xff, 0xfc, 0x7f, 0xfc, 0xff,
|
||||||
|
0xfc, 0x7f, 0xfc, 0xff, 0xfc, 0x00, 0x00, 0xff, 0xfe, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff
|
||||||
|
};
|
|
@ -0,0 +1,11 @@
|
||||||
|
static const unsigned char battery_25[513] PROGMEM = {
|
||||||
|
// 'battery_25', 32x32px
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xf8, 0x1f, 0xff,
|
||||||
|
0xff, 0x00, 0x00, 0xff, 0xfe, 0x00, 0x00, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f,
|
||||||
|
0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f,
|
||||||
|
0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f,
|
||||||
|
0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f,
|
||||||
|
0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f,
|
||||||
|
0xfe, 0x60, 0x06, 0x7f, 0xfe, 0x60, 0x06, 0x7f, 0xfe, 0x60, 0x06, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f,
|
||||||
|
0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff
|
||||||
|
};
|
|
@ -0,0 +1,11 @@
|
||||||
|
static const unsigned char battery_50[513] PROGMEM = {
|
||||||
|
// 'battery_50', 32x32px
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xf8, 0x1f, 0xff,
|
||||||
|
0xff, 0x00, 0x00, 0xff, 0xfe, 0x00, 0x00, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f,
|
||||||
|
0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f,
|
||||||
|
0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f,
|
||||||
|
0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x60, 0x06, 0x7f, 0xfe, 0x60, 0x06, 0x7f,
|
||||||
|
0xfe, 0x60, 0x06, 0x7f, 0xfe, 0x60, 0x06, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x60, 0x06, 0x7f,
|
||||||
|
0xfe, 0x60, 0x06, 0x7f, 0xfe, 0x60, 0x06, 0x7f, 0xfe, 0x60, 0x06, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f,
|
||||||
|
0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff
|
||||||
|
};
|
|
@ -1,11 +1,11 @@
|
||||||
static const unsigned char battery[513] PROGMEM = {
|
static const unsigned char battery_75[513] PROGMEM = {
|
||||||
// 'battery', 32x32px
|
// 'battery_75', 32x32px
|
||||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xf8, 0x1f, 0xff,
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xf8, 0x1f, 0xff,
|
||||||
0xff, 0x00, 0x00, 0x7f, 0xfe, 0x00, 0x00, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7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xfe, 0x7f, 0xfe, 0x7f,
|
||||||
0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x00, 0x00, 0x7f, 0xfe, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00, 0xff
|
0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff
|
||||||
};
|
};
|
|
@ -4,12 +4,16 @@
|
||||||
#include "catnip.h" // catnip
|
#include "catnip.h" // catnip
|
||||||
#include "christmas-cactus.h" // christmas_cactus
|
#include "christmas-cactus.h" // christmas_cactus
|
||||||
#include "tarragon.h" // tarragon
|
#include "tarragon.h" // tarragon
|
||||||
#include "battery.h" // battery
|
|
||||||
#include "humidity.h" // humidity
|
#include "humidity.h" // humidity
|
||||||
#include "temp_humidity.h" // temp_humidity
|
#include "temp_humidity.h" // temp_humidity
|
||||||
#include "temperature.h" // temperature
|
#include "temperature.h" // temperature
|
||||||
#include "warning_full.h" // warning_full
|
#include "warning_full.h" // warning_full
|
||||||
#include "warning.h" // warning
|
#include "warning.h" // warning
|
||||||
|
#include "battery_0.h" // battery_0
|
||||||
|
#include "battery_25.h" // battery_25
|
||||||
|
#include "battery_50.h" // battery_50
|
||||||
|
#include "battery_75.h" // battery_75
|
||||||
|
#include "battery_100.h" // battery_100
|
||||||
|
|
||||||
// SparkFun Fuel Gauge
|
// SparkFun Fuel Gauge
|
||||||
#include "MAX1704X.h"
|
#include "MAX1704X.h"
|
||||||
|
@ -44,6 +48,9 @@ GxEPD2_3C<GxEPD2_290c, MAX_HEIGHT_3C(GxEPD2_290c)> display(GxEPD2_290c(/*CS=77*/
|
||||||
const unsigned long SECOND = 1000;
|
const unsigned long SECOND = 1000;
|
||||||
const unsigned long HOUR = 3600*SECOND;
|
const unsigned long HOUR = 3600*SECOND;
|
||||||
|
|
||||||
|
// battery level var
|
||||||
|
float battery_percent;
|
||||||
|
|
||||||
// Temp/Humidity reading vars
|
// Temp/Humidity reading vars
|
||||||
float temp_c;
|
float temp_c;
|
||||||
float humid;
|
float humid;
|
||||||
|
@ -97,9 +104,24 @@ void loop()
|
||||||
|
|
||||||
// Get the voltage, battery percent
|
// Get the voltage, battery percent
|
||||||
// and other properties.
|
// and other properties.
|
||||||
display.drawInvertedBitmap(0, 0, battery, 32, 32, GxEPD_BLACK);
|
battery_percent = FuelGauge.percent();
|
||||||
|
if (battery_percent > 95.0) {
|
||||||
|
display.drawInvertedBitmap(0, 0, battery_100, 32, 32, GxEPD_BLACK);
|
||||||
|
}
|
||||||
|
else if (battery_percent > 75.0) {
|
||||||
|
display.drawInvertedBitmap(0, 0, battery_75, 32, 32, GxEPD_BLACK);
|
||||||
|
}
|
||||||
|
else if (battery_percent > 50.0) {
|
||||||
|
display.drawInvertedBitmap(0, 0, battery_50, 32, 32, GxEPD_BLACK);
|
||||||
|
}
|
||||||
|
else if (battery_percent > 25.0) {
|
||||||
|
display.drawInvertedBitmap(0, 0, battery_25, 32, 32, GxEPD_BLACK);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
display.drawInvertedBitmap(0, 0, battery_0, 32, 32, GxEPD_BLACK);
|
||||||
|
}
|
||||||
display.print(" ");
|
display.print(" ");
|
||||||
display.print(FuelGauge.percent());
|
display.print(battery_percent);
|
||||||
display.print("% / ");
|
display.print("% / ");
|
||||||
display.print(FuelGauge.voltage());
|
display.print(FuelGauge.voltage());
|
||||||
display.println("V");
|
display.println("V");
|
||||||
|
|