Skip to content

Commit 4452ddd

Browse files
author
Wouter D'Haeseleer
committed
Fixing battery monitor + make error more readable
1 parent b9570b1 commit 4452ddd

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

nitrox_analyzer.ino

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include <U8x8lib.h>
3333
#include <avr/wdt.h>
3434

35-
#define RA_SIZE 20
35+
#define RA_SIZE 16
3636
RunningAverage RA(RA_SIZE);
3737
RunningAverage battVolt(20);
3838

@@ -53,7 +53,7 @@ double oxVact = 0.0;
5353
float multiplier;
5454
byte previous = HIGH;
5555
unsigned long firstTime; // how long since the button was first pressed
56-
char battPcrt = 0;
56+
int battPcrt = 0;
5757
char active = 0;
5858
char bootcounter = 0;
5959
char toggle = 0;
@@ -360,10 +360,10 @@ void error(int e) {
360360

361361

362362
u8x8.setFont( u8x8_font_open_iconic_check_2x2 );
363-
u8x8.drawString(3,0,"D");
363+
u8x8.drawString(3,1,"D");
364364
u8x8.setFont(u8x8_font_chroma48medium8_r);
365-
u8x8.drawString(7,0,"SENSOR");
366-
u8x8.drawString(7,1,"ERROR");
365+
u8x8.drawString(7,1,"SENSOR");
366+
u8x8.drawString(7,2,"ERROR");
367367

368368

369369
u8x8.setInverseFont(1);
@@ -402,7 +402,7 @@ void batteryMonitor() {
402402
int battVolt_Value = analogRead(A0);
403403
battVolt.addValue(battVolt_Value * (5.0 / 1023.0));
404404
float volt = battVolt.getAverage();
405-
405+
406406
if ( volt >= 4.1 ) {
407407
battPcrt = 100;
408408
}
@@ -618,7 +618,7 @@ void analysing(int x, int cal, int cal100) {
618618

619619
u8x8.setCursor(0, 4);
620620
u8x8.print("Batt | ");
621-
u8x8.print(battVolt.getAverage() , 1);
621+
u8x8.print(battVolt.getAverage() , 2);
622622
u8x8.print(" V ");
623623

624624
u8x8.setCursor(0, 5);
@@ -629,12 +629,12 @@ void analysing(int x, int cal, int cal100) {
629629

630630
u8x8.setCursor(0, 6);
631631
if (cal100 > 0 ) {
632-
u8x8.print("Cal | Air + o2");
632+
u8x8.print("refmix| Air + o2");
633633
} else {
634-
u8x8.print("Cal | Air ");
634+
u8x8.print("refmix| Air ");
635635
}
636636
u8x8.setCursor(0, 7);
637-
u8x8.print("Firmw | 1.1");
637+
u8x8.print("Firmw | 1.2");
638638
}
639639
}
640640
}

0 commit comments

Comments
 (0)