Browse Source

Add multiple battery level icons

master
KemoNine 3 years ago
parent
commit
a1672a7c13
  1. BIN
      hardware/arduino/Plant_Monitor/icons/battery_0.bmp
  2. BIN
      hardware/arduino/Plant_Monitor/icons/battery_100.bmp
  3. BIN
      hardware/arduino/Plant_Monitor/icons/battery_25.bmp
  4. BIN
      hardware/arduino/Plant_Monitor/icons/battery_50.bmp
  5. BIN
      hardware/arduino/Plant_Monitor/icons/battery_75.bmp
  6. BIN
      hardware/arduino/Plant_Monitor/icons/noun_Full Battery_1601214.png
  7. BIN
      hardware/arduino/Plant_Monitor/icons/noun_battery level_1601219.png
  8. BIN
      hardware/arduino/Plant_Monitor/icons/noun_empty battery_1601215.png
  9. BIN
      hardware/arduino/Plant_Monitor/icons/noun_empty battery_1601218.png
  10. 11
      hardware/arduino/Plant_Monitor/ino/battery_0.h
  11. 12
      hardware/arduino/Plant_Monitor/ino/battery_100.h
  12. 11
      hardware/arduino/Plant_Monitor/ino/battery_25.h
  13. 11
      hardware/arduino/Plant_Monitor/ino/battery_50.h
  14. 14
      hardware/arduino/Plant_Monitor/ino/battery_75.h
  15. 28
      hardware/arduino/Plant_Monitor/ino/ino.ino

BIN
hardware/arduino/Plant_Monitor/icons/battery_0.bmp

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
hardware/arduino/Plant_Monitor/icons/battery_100.bmp

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
hardware/arduino/Plant_Monitor/icons/battery_25.bmp

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
hardware/arduino/Plant_Monitor/icons/battery.bmp → hardware/arduino/Plant_Monitor/icons/battery_50.bmp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
hardware/arduino/Plant_Monitor/icons/battery_75.bmp

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
hardware/arduino/Plant_Monitor/icons/noun_Full Battery_1601214.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
hardware/arduino/Plant_Monitor/icons/noun_battery level_1601219.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
hardware/arduino/Plant_Monitor/icons/noun_empty battery_1601215.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
hardware/arduino/Plant_Monitor/icons/noun_empty battery_1601218.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

11
hardware/arduino/Plant_Monitor/ino/battery_0.h

@ -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
};

12
hardware/arduino/Plant_Monitor/ino/battery_100.h

@ -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
};

11
hardware/arduino/Plant_Monitor/ino/battery_25.h

@ -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
};

11
hardware/arduino/Plant_Monitor/ino/battery_50.h

@ -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
};

14
hardware/arduino/Plant_Monitor/ino/battery.h → hardware/arduino/Plant_Monitor/ino/battery_75.h

@ -1,11 +1,11 @@
static const unsigned char battery[513] PROGMEM = {
// 'battery', 32x32px
static const unsigned char battery_75[513] PROGMEM = {
// 'battery_75', 32x32px
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, 0x7f,
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, 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, 0x60, 0x06, 0x7f, 0xfe, 0x60, 0x06, 0x7f, 0xfe, 0x60, 0x06, 0x7f, 0xfe, 0x60, 0x06, 0x7f,
0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x00, 0x00, 0x7f, 0xfe, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00, 0xff
};
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
};

28
hardware/arduino/Plant_Monitor/ino/ino.ino

@ -4,12 +4,16 @@
#include "catnip.h" // catnip
#include "christmas-cactus.h" // christmas_cactus
#include "tarragon.h" // tarragon
#include "battery.h" // battery
#include "humidity.h" // humidity
#include "temp_humidity.h" // temp_humidity
#include "temperature.h" // temperature
#include "warning_full.h" // warning_full
#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
#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 HOUR = 3600*SECOND;
// battery level var
float battery_percent;
// Temp/Humidity reading vars
float temp_c;
float humid;
@ -97,9 +104,24 @@ void loop()
// Get the voltage, battery percent
// 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(FuelGauge.percent());
display.print(battery_percent);
display.print("% / ");
display.print(FuelGauge.voltage());
display.println("V");

Loading…
Cancel
Save