Finalizing batt icon scale.
This commit is contained in:
@@ -37,15 +37,14 @@ Adafruit_SSD1306 display(OLED_RESET);
|
||||
|
||||
|
||||
// Function declarations
|
||||
void zero();
|
||||
void one();
|
||||
void two();
|
||||
void three();
|
||||
void four();
|
||||
void read_serial();
|
||||
void write_serial();
|
||||
void config();
|
||||
void batt_icon();
|
||||
void one(); // Menu one
|
||||
void two(); // Menu two
|
||||
void three(); // Menu three
|
||||
void four(); // Menu four
|
||||
void read_serial(); // Menu that reads the serial
|
||||
void write_serial(); // Menu that writes to serial
|
||||
void config(); // Configuration menu
|
||||
void batt_icon(); // Draws the battery icon acording to value
|
||||
|
||||
|
||||
// Variables creation
|
||||
@@ -83,12 +82,6 @@ void setup() { // BEGIN SETUP ------------------------------------
|
||||
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for the 128x32)
|
||||
// init done
|
||||
|
||||
// Show image buffer on the display hardware.
|
||||
// Since the buffer is intialized with an Adafruit splashscreen
|
||||
// internally, this will display the splashscreen.
|
||||
//display.display();
|
||||
//delay(2000); // Wait 2 seconds
|
||||
|
||||
|
||||
// initialize timer1 ---------------------------------------
|
||||
noInterrupts(); // disable all interrupts
|
||||
@@ -118,14 +111,13 @@ void setup() { // BEGIN SETUP ------------------------------------
|
||||
display.clearDisplay();
|
||||
display.display();
|
||||
|
||||
|
||||
} // END 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
|
||||
ISR(TIMER1_COMPA_vect) //
|
||||
{ //
|
||||
if (!rUP) {
|
||||
if (menuState == 1) {
|
||||
menuState = 1;
|
||||
@@ -205,6 +197,7 @@ void loop() {
|
||||
|
||||
batt_val = analogRead(batt);
|
||||
|
||||
// Routine to check the battery analog value for calibration
|
||||
/* display.drawRect(0, 8, 168, 24, BLACK);
|
||||
display.display();
|
||||
display.clearDisplay();
|
||||
@@ -213,7 +206,7 @@ void loop() {
|
||||
display.setCursor(50,18);
|
||||
display.println(batt_val);
|
||||
batt_icon();
|
||||
display.display(); */
|
||||
display.display();*/
|
||||
|
||||
|
||||
|
||||
@@ -261,10 +254,23 @@ void batt_icon (void) {
|
||||
}
|
||||
|
||||
else if ((batt_val > 901) & (batt_val < 962)) {
|
||||
// Draw the battery icon - Half full battery
|
||||
// Draw the battery icon - 2/3 battery
|
||||
display.drawRect(111, 1, 16, 6, WHITE);
|
||||
display.drawRect(119, 2, 7, 4, WHITE);
|
||||
display.drawRect(120, 3, 5, 2, WHITE);
|
||||
display.drawRect(116, 2, 10, 4, WHITE);
|
||||
display.drawRect(117, 3, 8, 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 > 840) & (batt_val < 901)) {
|
||||
// Draw the battery icon - 1/3 battery
|
||||
display.drawRect(111, 1, 16, 6, WHITE);
|
||||
display.drawRect(121, 2, 5, 4, WHITE);
|
||||
display.drawRect(122, 3, 3, 2, WHITE);
|
||||
display.drawPixel(110, 3, WHITE);
|
||||
display.drawPixel(110, 4, WHITE);
|
||||
display.drawPixel(109, 3, WHITE);
|
||||
@@ -287,21 +293,6 @@ void batt_icon (void) {
|
||||
}
|
||||
}
|
||||
|
||||
void zero (void) {
|
||||
|
||||
display.drawRect(0, 8, 168, 24, BLACK);
|
||||
display.display();
|
||||
display.setTextSize(1);
|
||||
display.setTextColor(WHITE);
|
||||
display.setCursor(1,12);
|
||||
display.println("Read NMEA0183");
|
||||
display.setCursor(1,22);
|
||||
display.println("Write NMEA0183");
|
||||
batt_icon();
|
||||
display.display();
|
||||
|
||||
}
|
||||
|
||||
void one (void) {
|
||||
|
||||
display.drawRect(0, 8, 168, 24, BLACK);
|
||||
|
Reference in New Issue
Block a user