moved batteryVoltage

pull/54/head
alanbjohnston 5 years ago committed by GitHub
parent 20d6b946c8
commit ee77e6c494
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -126,7 +126,7 @@ float sleepTime;
int sampleTime = 0, frames_sent = 0; int sampleTime = 0, frames_sent = 0;
int cw_id = ON; int cw_id = ON;
int vB4 = FALSE, vB5 = FALSE, ax5043 = FALSE, transmit = FALSE, onLed, onLedOn, onLedOff, txLed, txLedOn, txLedOff, payload = OFF; int vB4 = FALSE, vB5 = FALSE, ax5043 = FALSE, transmit = FALSE, onLed, onLedOn, onLedOff, txLed, txLedOn, txLedOff, payload = OFF;
float batteryThreshold = 0; float batteryThreshold = 0, batteryVoltage;
const char pythonCmd[] = "python3 /home/pi/CubeSatSim/python/voltcurrent.py "; const char pythonCmd[] = "python3 /home/pi/CubeSatSim/python/voltcurrent.py ";
char pythonStr[100], pythonConfigStr[100], busStr[10]; char pythonStr[100], pythonConfigStr[100], busStr[10];
@ -606,7 +606,7 @@ while (loop-- != 0)
{ {
frames_sent++; frames_sent++;
// float batteryVoltage = read_sensor_data(sensor[BAT]).voltage; // float batteryVoltage = read_sensor_data(sensor[BAT]).voltage;
float batteryVoltage = voltage(map[BAT]);
#ifdef DEBUG_LOGGING #ifdef DEBUG_LOGGING
fprintf(stderr,"INFO: Battery voltage: %f V Battery Threshold %f V\n", batteryVoltage, batteryThreshold); fprintf(stderr,"INFO: Battery voltage: %f V Battery Threshold %f V\n", batteryVoltage, batteryThreshold);
#endif #endif
@ -839,6 +839,8 @@ for (int j = 0; j < frameCnt; j++)
tlm[3][A] = abs((int)((voltage[map[BAT]] * 10.0) - 65.5) % 100); tlm[3][A] = abs((int)((voltage[map[BAT]] * 10.0) - 65.5) % 100);
tlm[3][B] = (int)(voltage[map[BUS]] * 10.0) % 100; // 5V supply to Pi tlm[3][B] = (int)(voltage[map[BUS]] * 10.0) % 100; // 5V supply to Pi
batteryVoltage = voltage[map[BAT]];
if (ax5043) if (ax5043)
{ {
if (tempSensor.fd != OFF) { if (tempSensor.fd != OFF) {
@ -1255,7 +1257,9 @@ if (firstTime != ON)
PSUCurrent = (int)current[map[BUS]] + 2048; PSUCurrent = (int)current[map[BUS]] + 2048;
if (payload == ON) if (payload == ON)
STEMBoardFailure = 0; STEMBoardFailure = 0;
batteryVoltage = voltage[map[BAT]];
encodeA(b, 0 + head_offset, batt_a_v); encodeA(b, 0 + head_offset, batt_a_v);
encodeB(b, 1 + head_offset, batt_b_v); encodeB(b, 1 + head_offset, batt_b_v);
encodeA(b, 3 + head_offset, batt_c_v); encodeA(b, 3 + head_offset, batt_c_v);

Loading…
Cancel
Save

Powered by TurnKey Linux.