fprintf(stderr,"INFO: Battery voltage: %5.2f V Threshold %5.2f V Current: %6.1f mA Threshold: %6.1f mA\n",batteryVoltage,voltageThreshold,batteryCurrent,currentThreshold);
fprintf(stderr,"INFO: Battery voltage: %5.2f V Threshold %5.2f V Current: %6.1f mA Threshold: %6.1f mA\n",batteryVoltage,voltageThreshold,batteryCurrent,currentThreshold);
#endif
#endif
// if ((batteryVoltage > 1.0) && (batteryVoltage < batteryThreshold)) // no battery INA219 will give 0V, no battery plugged into INA219 will read < 1V
// if ((batteryVoltage > 1.0) && (batteryVoltage < batteryThreshold)) // no battery INA219 will give 0V, no battery plugged into INA219 will read < 1V
/**/
/*
if((batteryCurrent>currentThreshold)&&(batteryVoltage<voltageThreshold)&&!sim_mode)// currentThreshold ensures that this won't happen when running on DC power.
if((batteryCurrent>currentThreshold)&&(batteryVoltage<voltageThreshold)&&!sim_mode)// currentThreshold ensures that this won't happen when running on DC power.
{
{
fprintf(stderr,"Battery voltage too low: %f V - shutting down!\n",batteryVoltage);
fprintf(stderr,"Battery voltage too low: %f V - shutting down!\n",batteryVoltage);
@ -791,12 +795,12 @@ void setup {
pclose(file6);
pclose(file6);
sleep(10);
sleep(10);
}
}
/**/
*/
// sleep(1); // Delay 1 second
// sleep(1); // Delay 1 second
ctr=0;
ctr=0;
#ifdef DEBUG_LOGGING
/// #ifdef DEBUG_LOGGING
// fprintf(stderr, "INFO: Getting TLM Data\n");
// fprintf(stderr, "INFO: Getting TLM Data\n");
#endif
/// #endif
if((mode==AFSK)||(mode==CW)){
if((mode==AFSK)||(mode==CW)){
get_tlm();
get_tlm();
@ -807,11 +811,11 @@ void setup {
sleep(50);
sleep(50);
}
}
#ifdef DEBUG_LOGGING
/// #ifdef DEBUG_LOGGING
// fprintf(stderr, "INFO: Getting ready to send\n");
// fprintf(stderr, "INFO: Getting ready to send\n");
#endif
/// #endif
}
}
/*
if(mode==BPSK){
if(mode==BPSK){
// digitalWrite(txLed, txLedOn);
// digitalWrite(txLed, txLedOn);
#ifdef DEBUG_LOGGING
#ifdef DEBUG_LOGGING
@ -831,6 +835,7 @@ void setup {
}
}
return0;
return0;
*/
}
}
// Returns lower digit of a number which must be less than 99
// Returns lower digit of a number which must be less than 99
@ -841,7 +846,7 @@ int lower_digit(int number) {
if(number<100)
if(number<100)
digit=number-((int)(number/10)*10);
digit=number-((int)(number/10)*10);
else
else
fprintf(stderr,"ERROR: Not a digit in lower_digit!\n");
Serial.println("ERROR: Not a digit in lower_digit!\n");
returndigit;
returndigit;
}
}
@ -854,10 +859,10 @@ int upper_digit(int number) {
digit=(int)(number/10);
digit=(int)(number/10);
else
else
fprintf(stderr,"ERROR: Not a digit in upper_digit!\n");
Serial.println("ERROR: Not a digit in upper_digit!\n");