This commit is contained in:
Max Hunt 2020-01-11 17:55:15 +00:00
parent ed783b4b23
commit 796e93fe60
246 changed files with 55 additions and 5 deletions

BIN
Code/bat-b.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
Code/chd-b.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
Code/chg-b.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
Code/test.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -153,7 +153,7 @@ void loop() {
}
}
if ((powerState == false && screenState == 0) && (charging_1 == false && charging_2 == false)) {
LowPower.powerDown(SLEEP_1S, ADC_OFF, BOD_OFF);
// LowPower.powerDown(SLEEP_1S, ADC_OFF, BOD_OFF);
}
}
@ -264,10 +264,10 @@ void updateDisplayChg(){
void updateDispayHelper(){
int batteryPct = getPct();
if (charging_1 == true && batteryPct != 100) {display.drawBitmap(118, 0, charge_logo, 16, 14, 1); screenOn = true;}
else if (charging_2 == true && batteryPct != 100) {display.drawBitmap(118, 16, charge_logo, 16, 14, 1); screenOn = true;}
else if (charging_1 == true && batteryPct == 100) {display.drawBitmap(118, 0, charged_logo, 16, 14, 1); screenOn = true;}
else if (charging_2 == true && batteryPct == 100) {display.drawBitmap(118, 16, charged_logo, 16, 14, 1); screenOn = true;}
if (charging_1 == true && batteryPct < 100) {display.drawBitmap(118, 0, charge_logo, 16, 14, 1); screenOn = true;}
else if (charging_2 == true && batteryPct < 100) {display.drawBitmap(118, 16, charge_logo, 16, 14, 1); screenOn = true;}
else if (charging_1 == true && batteryPct > 99) {display.drawBitmap(118, 0, charged_logo, 16, 14, 1); screenOn = true;}
else if (charging_2 == true && batteryPct > 99) {display.drawBitmap(118, 16, charged_logo, 16, 14, 1); screenOn = true;}
}
double getVoltage(){

50
Code/vLogger.py Normal file
View File

@ -0,0 +1,50 @@
#!/usr/bin/python3
import serial
import syslog
from datetime import datetime
import time
import csv
import serial.tools.list_ports
while True:
myports = [tuple(p) for p in list(serial.tools.list_ports.comports())]
port1 = '/dev/ttyUSB0'
port2 = '/dev/ttyUSB1'
ports = [port1, port2]
collecting = False
for x in myports:
for port in ports:
if port in x:
try:
print("Trying port " + str(port))
ser = serial.Serial(port,9600,timeout=5)
print("Running on port: " + str(port))
collecting = True
except:
print("Failed to open " + str(port))
while collecting:
try:
ser.reset_input_buffer()
raw_msg = ser.readline()
msg = raw_msg.rstrip().decode('utf-8')
with open('test.csv', 'a+', newline='') as csvfile:
spamwriter = csv.writer(csvfile, delimiter=',', quotechar='|', quoting=csv.QUOTE_MINIMAL)
if msg != "":
now = datetime.now()
dt_string = now.strftime("%d/%m/%Y %H:%M:%S")
spamwriter.writerow([dt_string, msg])
if msg != "":
time.sleep(2)
except:
print("Error on port " + str(port)+ " ,terminating")
collecting = False
time.sleep(2)
print("Stopped.")
# caffeine.off()

View File

Before

Width:  |  Height:  |  Size: 293 KiB

After

Width:  |  Height:  |  Size: 293 KiB

Some files were not shown because too many files have changed in this diff Show More