diff --git a/firmware/v01/v01.ino b/firmware/v01/v01.ino index c7b0a0f..6361f0f 100644 --- a/firmware/v01/v01.ino +++ b/firmware/v01/v01.ino @@ -48,8 +48,6 @@ void config(); void batt_icon(); -//volatile byte state = LOW; - // Variables creation int menuState = 1; // Integer with the number of the menu you are in int prevMenu = 1; // Previous menu @@ -128,7 +126,6 @@ void setup() { // BEGIN SETUP ------------------------------------ // Timer compare interrupt service routine -------------------------- ISR(TIMER1_COMPA_vect) // Here we chose between the blinker sequence { // or to show the temperature on the LEDs -/* if (!rUP) { if (menuState == 1) { menuState = 1; @@ -199,21 +196,16 @@ ISR(TIMER1_COMPA_vect) // Here we chose between the blinker sequence } while (!rCANCEL); // Check if button is still pressed do nothing } -*/ } // ------------------------------------------------------------------- void loop() { - //digitalWrite(led2, !digitalRead(led2)); // toggle state - - - batt_val = analogRead(batt); - display.drawRect(0, 8, 168, 24, BLACK); +/* display.drawRect(0, 8, 168, 24, BLACK); display.display(); display.clearDisplay(); display.setTextSize(1); @@ -221,15 +213,10 @@ void loop() { display.setCursor(50,18); display.println(batt_val); batt_icon(); - display.display(); + display.display(); */ - -// HERE AGAIN - - - -/* + if (menuState == 1) { one(); } @@ -254,20 +241,50 @@ void loop() { else { one(); } -*/ } void batt_icon (void) { - // Draw the battery icon - display.drawRect(111, 1, 16, 6, WHITE); - display.drawPixel(110, 3, WHITE); - display.drawPixel(110, 4, WHITE); - display.drawPixel(109, 3, WHITE); - display.drawPixel(109, 4, WHITE); - display.drawPixel(108, 3, WHITE); - display.drawPixel(108, 4, WHITE); + + if (batt_val > 962) { + // Draw the battery icon - Full battery + display.drawRect(111, 1, 16, 6, WHITE); + display.drawRect(112, 2, 14, 4, WHITE); + display.drawRect(113, 3, 12, 2, WHITE); + display.drawPixel(110, 3, WHITE); + display.drawPixel(110, 4, WHITE); + display.drawPixel(109, 3, WHITE); + display.drawPixel(109, 4, WHITE); + display.drawPixel(108, 3, WHITE); + display.drawPixel(108, 4, WHITE); + } + + else if ((batt_val > 901) & (batt_val < 962)) { + // Draw the battery icon - Half full battery + display.drawRect(111, 1, 16, 6, WHITE); + display.drawRect(119, 2, 7, 4, WHITE); + display.drawRect(120, 3, 5, 2, WHITE); + display.drawPixel(110, 3, WHITE); + display.drawPixel(110, 4, WHITE); + display.drawPixel(109, 3, WHITE); + display.drawPixel(109, 4, WHITE); + display.drawPixel(108, 3, WHITE); + display.drawPixel(108, 4, WHITE); + } + + else { + // Draw the battery icon - Empty battery + display.setCursor(35,1); + display.println("BATT LOW"); + display.drawRect(111, 1, 16, 6, WHITE); + display.drawPixel(110, 3, WHITE); + display.drawPixel(110, 4, WHITE); + display.drawPixel(109, 3, WHITE); + display.drawPixel(109, 4, WHITE); + display.drawPixel(108, 3, WHITE); + display.drawPixel(108, 4, WHITE); + } } void zero (void) {