Update
This commit is contained in:
parent
317bea64ff
commit
f4cf5f4616
@ -7,7 +7,7 @@
|
|||||||
#include "Arduino.h"
|
#include "Arduino.h"
|
||||||
|
|
||||||
#include "LowPower.h"
|
#include "LowPower.h"
|
||||||
#include <avr/wdt.h>
|
//#include <avr/wdt.h>
|
||||||
|
|
||||||
#define SCREEN_WIDTH 128
|
#define SCREEN_WIDTH 128
|
||||||
#define SCREEN_HEIGHT 32
|
#define SCREEN_HEIGHT 32
|
||||||
@ -114,13 +114,6 @@ static const int dimmerVals[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
delay(100);
|
|
||||||
wdt_enable(WDTO_8S);
|
|
||||||
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
|
|
||||||
display.clearDisplay();
|
|
||||||
display.setTextColor(WHITE);
|
|
||||||
Wire.begin();
|
|
||||||
Serial.begin(9600);
|
|
||||||
pinMode(VBAT, INPUT);
|
pinMode(VBAT, INPUT);
|
||||||
pinMode(CSTAT1, INPUT);
|
pinMode(CSTAT1, INPUT);
|
||||||
pinMode(CSTAT2, INPUT);
|
pinMode(CSTAT2, INPUT);
|
||||||
@ -129,19 +122,30 @@ void setup() {
|
|||||||
pinMode(CHGLED, OUTPUT);
|
pinMode(CHGLED, OUTPUT);
|
||||||
pinMode(PWRBTN, INPUT_PULLUP);
|
pinMode(PWRBTN, INPUT_PULLUP);
|
||||||
pinMode(CHGBTN, INPUT_PULLUP);
|
pinMode(CHGBTN, INPUT_PULLUP);
|
||||||
|
digitalWrite(PWRLED, HIGH);
|
||||||
|
digitalWrite(CHGLED, HIGH);
|
||||||
|
delay(100);
|
||||||
|
// wdt_enable(WDTO_8S);
|
||||||
|
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
|
||||||
|
display.clearDisplay();
|
||||||
|
display.setTextColor(WHITE);
|
||||||
|
Wire.begin();
|
||||||
|
// Serial.begin(9600);
|
||||||
digitalWrite(FETCTRL, LOW);
|
digitalWrite(FETCTRL, LOW);
|
||||||
resetScreen();
|
resetScreen();
|
||||||
delay(200);
|
delay(200);
|
||||||
FuelGauge.begin();
|
FuelGauge.begin();
|
||||||
FuelGauge.reset(); //<== Might cause problems
|
FuelGauge.reset(); //<== Might cause problems
|
||||||
FuelGauge.quickstart();
|
FuelGauge.quickstart();
|
||||||
|
digitalWrite(PWRLED, LOW);
|
||||||
|
digitalWrite(CHGLED, LOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
delay(100);
|
delay(100);
|
||||||
delay(900);
|
delay(900);
|
||||||
Serial.println(getVoltage());
|
// Serial.println(getVoltage());
|
||||||
wdt_reset();
|
// wdt_reset();
|
||||||
checkPresses();
|
checkPresses();
|
||||||
checkCharging();
|
checkCharging();
|
||||||
safetyCheck();
|
safetyCheck();
|
||||||
@ -255,6 +259,7 @@ void updateScreen(){
|
|||||||
screenOn = true;
|
screenOn = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void updateDisplayChg(){
|
void updateDisplayChg(){
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
updateDispayHelper();
|
updateDispayHelper();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user