forked from AngeloCasi/FUGU-ARDUINO-MPPT-FIRMWARE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
6_Onboard_Telemetry.ino
86 lines (81 loc) · 4.39 KB
/
6_Onboard_Telemetry.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
void Onboard_Telemetry(){
/////////////////////// USB SERIAL DATA TELEMETRY ////////////////////////
// 0 - Disable Serial
// 1 - Display All
// 2 - Display Essential Data
// 3 - Display Numbers Only
currentSerialMillis = millis();
if(currentSerialMillis-prevSerialMillis>=millisSerialInterval){ //Run routine every millisRoutineInterval (ms)
prevSerialMillis = currentSerialMillis; //Store previous time
if(serialTelemMode==0){}
// else if(chargingPause==1){Serial.println("CHARGING PAUSED");} // Charging paused message
else if(serialTelemMode==1){ // 1 - Display All
Serial.print(" ERR:"); Serial.print(ERR);
Serial.print(" FLV:"); Serial.print(FLV);
Serial.print(" BNC:"); Serial.print(BNC);
Serial.print(" IUV:"); Serial.print(IUV);
Serial.print(" IOC:"); Serial.print(IOC);
Serial.print(" OOV:"); Serial.print(OOV);
Serial.print(" OOC:"); Serial.print(OOC);
Serial.print(" OTE:"); Serial.print(OTE);
Serial.print(" REC:"); Serial.print(REC);
Serial.print(" MPPTA:"); Serial.print(MPPT_Mode);
Serial.print(" CM:"); Serial.print(output_Mode); //Charging Mode
Serial.print(" ");
Serial.print(" BYP:"); Serial.print(bypassEnable);
Serial.print(" EN:"); Serial.print(buckEnable);
Serial.print(" FAN:"); Serial.print(fanStatus);
Serial.print(" WiFi:"); Serial.print(WIFI);
Serial.print(" ");
Serial.print(" PI:"); Serial.print(powerInput,0);
Serial.print(" PWM:"); Serial.print(PWM);
Serial.print(" PPWM:"); Serial.print(PPWM);
Serial.print(" VI:"); Serial.print(voltageInput,1);
Serial.print(" VO:"); Serial.print(voltageOutput,1);
Serial.print(" CI:"); Serial.print(currentInput,2);
Serial.print(" CO:"); Serial.print(currentOutput,2);
Serial.print(" Wh:"); Serial.print(Wh,2);
Serial.print(" Temp:"); Serial.print(temperature,1);
Serial.print(" ");
Serial.print(" CSMPV:"); Serial.print(currentMidPoint,3);
Serial.print(" CSV:"); Serial.print(CSI_converted,3);
Serial.print(" VO%Dev:");Serial.print(outputDeviation,1);
Serial.print(" SOC:"); Serial.print(batteryPercent);Serial.print("%");
Serial.print(" T:"); Serial.print(secondsElapsed);
Serial.print(" LoopT:"); Serial.print(loopTime,3);Serial.print("ms");
Serial.println("");
}
else if(serialTelemMode==2){ // 2 - Display Essential Data
Serial.print(" PI:"); Serial.print(powerInput,0);
Serial.print(" PWM:"); Serial.print(PWM);
Serial.print(" PPWM:"); Serial.print(PPWM);
Serial.print(" VI:"); Serial.print(voltageInput,1);
Serial.print(" VO:"); Serial.print(voltageOutput,1);
Serial.print(" CI:"); Serial.print(currentInput,2);
Serial.print(" CO:"); Serial.print(currentOutput,2);
Serial.print(" Wh:"); Serial.print(Wh,2);
Serial.print(" Temp:"); Serial.print(temperature,1);
Serial.print(" EN:"); Serial.print(buckEnable);
Serial.print(" FAN:"); Serial.print(fanStatus);
Serial.print(" SOC:"); Serial.print(batteryPercent);Serial.print("%");
Serial.print(" T:"); Serial.print(secondsElapsed);
Serial.print(" LoopT:"); Serial.print(loopTime,3);Serial.print("ms");
Serial.println("");
}
else if(serialTelemMode==3){ // 3 - Display Numbers Only
Serial.print(" "); Serial.print(powerInput,0);
Serial.print(" "); Serial.print(voltageInput,1);
Serial.print(" "); Serial.print(voltageOutput,1);
Serial.print(" "); Serial.print(currentInput,2);
Serial.print(" "); Serial.print(currentOutput,2);
Serial.print(" "); Serial.print(Wh,2);
Serial.print(" "); Serial.print(temperature,1);
Serial.print(" "); Serial.print(buckEnable);
Serial.print(" "); Serial.print(fanStatus);
Serial.print(" "); Serial.print(batteryPercent);
Serial.print(" "); Serial.print(secondsElapsed);
Serial.print(" "); Serial.print(loopTime,3);
Serial.print(" "); Serial.println("");
}
}
}