|
|
|
@ -489,30 +489,6 @@ int main(int argc, char * argv[]) {
|
|
|
|
other_max[i] = -1000.0;
|
|
|
|
other_max[i] = -1000.0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
while (loop-- != 0) {
|
|
|
|
|
|
|
|
frames_sent++;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_LOGGING
|
|
|
|
|
|
|
|
fprintf(stderr, "INFO: Battery voltage: %f V Battery Threshold %f V\n", batteryVoltage, batteryThreshold);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if ((batteryVoltage > 1.0) && (batteryVoltage < batteryThreshold)) // no battery INA219 will give 0V, no battery plugged into INA219 will read < 1V
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
fprintf(stderr, "Battery voltage too low: %f V - shutting down!\n", batteryVoltage);
|
|
|
|
|
|
|
|
digitalWrite(txLed, txLedOff);
|
|
|
|
|
|
|
|
digitalWrite(onLed, onLedOff);
|
|
|
|
|
|
|
|
sleep(1);
|
|
|
|
|
|
|
|
digitalWrite(onLed, onLedOn);
|
|
|
|
|
|
|
|
sleep(1);
|
|
|
|
|
|
|
|
digitalWrite(onLed, onLedOff);
|
|
|
|
|
|
|
|
sleep(1);
|
|
|
|
|
|
|
|
digitalWrite(onLed, onLedOn);
|
|
|
|
|
|
|
|
sleep(1);
|
|
|
|
|
|
|
|
digitalWrite(onLed, onLedOff);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
popen("sudo shutdown -h now > /dev/null 2>&1", "r");
|
|
|
|
|
|
|
|
sleep(10);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mode == FSK) {
|
|
|
|
if (mode == FSK) {
|
|
|
|
bitRate = 200;
|
|
|
|
bitRate = 200;
|
|
|
|
rsFrames = 1;
|
|
|
|
rsFrames = 1;
|
|
|
|
@ -556,6 +532,32 @@ int main(int argc, char * argv[]) {
|
|
|
|
bufLen, bufLen / (samples * frameCnt), bitRate, bufLen / (samples * frameCnt * bitRate), samplePeriod);
|
|
|
|
bufLen, bufLen / (samples * frameCnt), bitRate, bufLen / (samples * frameCnt * bitRate), samplePeriod);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (loop-- != 0) {
|
|
|
|
|
|
|
|
frames_sent++;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_LOGGING
|
|
|
|
|
|
|
|
fprintf(stderr, "INFO: Battery voltage: %f V Battery Threshold %f V\n", batteryVoltage, batteryThreshold);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if ((batteryVoltage > 1.0) && (batteryVoltage < batteryThreshold)) // no battery INA219 will give 0V, no battery plugged into INA219 will read < 1V
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
fprintf(stderr, "Battery voltage too low: %f V - shutting down!\n", batteryVoltage);
|
|
|
|
|
|
|
|
digitalWrite(txLed, txLedOff);
|
|
|
|
|
|
|
|
digitalWrite(onLed, onLedOff);
|
|
|
|
|
|
|
|
sleep(1);
|
|
|
|
|
|
|
|
digitalWrite(onLed, onLedOn);
|
|
|
|
|
|
|
|
sleep(1);
|
|
|
|
|
|
|
|
digitalWrite(onLed, onLedOff);
|
|
|
|
|
|
|
|
sleep(1);
|
|
|
|
|
|
|
|
digitalWrite(onLed, onLedOn);
|
|
|
|
|
|
|
|
sleep(1);
|
|
|
|
|
|
|
|
digitalWrite(onLed, onLedOff);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
popen("sudo shutdown -h now > /dev/null 2>&1", "r");
|
|
|
|
|
|
|
|
sleep(10);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// sleep(1); // Delay 1 second
|
|
|
|
// sleep(1); // Delay 1 second
|
|
|
|
ctr = 0;
|
|
|
|
ctr = 0;
|
|
|
|
#ifdef DEBUG_LOGGING
|
|
|
|
#ifdef DEBUG_LOGGING
|
|
|
|
@ -1046,10 +1048,10 @@ void get_tlm_fox() {
|
|
|
|
#ifdef DEBUG_LOGGING
|
|
|
|
#ifdef DEBUG_LOGGING
|
|
|
|
printf("Tx LED On\n");
|
|
|
|
printf("Tx LED On\n");
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
while ((millis() - sampleTime) < (unsigned int)samplePeriod)
|
|
|
|
while ((millis() - sampleTime) < (unsigned int)samplePeriod)
|
|
|
|
sleep((unsigned int)sleepTime);
|
|
|
|
sleep((unsigned int)sleepTime);
|
|
|
|
|
|
|
|
*/
|
|
|
|
digitalWrite(txLed, txLedOff);
|
|
|
|
digitalWrite(txLed, txLedOff);
|
|
|
|
#ifdef DEBUG_LOGGING
|
|
|
|
#ifdef DEBUG_LOGGING
|
|
|
|
printf("Tx LED Off\n");
|
|
|
|
printf("Tx LED Off\n");
|
|
|
|
|