Update
BIN
Code/bat-b.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
Code/chd-b.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
Code/chg-b.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
Code/test.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
@ -153,7 +153,7 @@ void loop() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((powerState == false && screenState == 0) && (charging_1 == false && charging_2 == false)) {
|
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(){
|
void updateDispayHelper(){
|
||||||
int batteryPct = getPct();
|
int batteryPct = getPct();
|
||||||
if (charging_1 == true && batteryPct != 100) {display.drawBitmap(118, 0, charge_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_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_1 == true && batteryPct > 99) {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;}
|
else if (charging_2 == true && batteryPct > 99) {display.drawBitmap(118, 16, charged_logo, 16, 14, 1); screenOn = true;}
|
||||||
}
|
}
|
||||||
|
|
||||||
double getVoltage(){
|
double getVoltage(){
|
||||||
50
Code/vLogger.py
Normal 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()
|
||||||
|
Before Width: | Height: | Size: 293 KiB After Width: | Height: | Size: 293 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 42 B After Width: | Height: | Size: 42 B |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 43 B After Width: | Height: | Size: 43 B |
|
Before Width: | Height: | Size: 49 B After Width: | Height: | Size: 49 B |
|
Before Width: | Height: | Size: 49 B After Width: | Height: | Size: 49 B |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 49 B After Width: | Height: | Size: 49 B |