Merge pull request #49 from alanbjohnston/dev

Changes to battery auto shutdown and Tx sensing
pull/52/head
alanbjohnston 5 years ago committed by GitHub
commit ff2557dcb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -405,7 +405,7 @@ int main(int argc, char *argv[]) {
pinMode (onLed, OUTPUT);
digitalWrite (onLed, onLedOn);
#ifdef DEBUG_LOGGING
printf("Tx LED On\n");
printf("Power LED On\n");
#endif
// if ((cycle == ON) && !ax5043) // don't cycle modes if using AX5043
@ -416,7 +416,6 @@ int main(int argc, char *argv[]) {
fclose(config_file);
config_file = fopen("sim.cfg","r");
if (vB4)
{
sensor[PLUS_X] = config_sensor("/dev/i2c-1", 0x40, 400);
@ -551,11 +550,23 @@ while (loop-- != 0)
#ifdef DEBUG_LOGGING
fprintf(stderr,"INFO: Battery voltage: %f V Battery Threshold %f V\n", batteryVoltage, batteryThreshold);
#endif
if ((batteryVoltage > 0) && (batteryVoltage < batteryThreshold))
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) {
bitRate = 200;

@ -27,6 +27,9 @@ os.system("echo 'de " + callsign + "' > id.txt && gen_packets -M 20 id.txt -o mo
time.sleep(2)
if __name__ == "__main__":
if (transmit):
print 'Length: ', len(sys.argv)
if (len(sys.argv)) > 1:
@ -44,3 +47,7 @@ if __name__ == "__main__":
else:
print("FSK")
os.system("sudo nc -l 8080 | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.9e3")
else:
print("No Band Pass Filter so no telemetry transmit. See http://cubesatsim.org/wiki for instructions on how to build the BPF.")
while True:
time.sleep(5)

Loading…
Cancel
Save

Powered by TurnKey Linux.