diff --git a/afsk/main.c b/afsk/main.c index 2bb8ba99..385bfcc7 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -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 @@ -415,8 +415,7 @@ int main(int argc, char *argv[]) { fprintf(config_file, "%s %d", call, reset_count); 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; diff --git a/rpitx.py b/rpitx.py index bbfecbc4..fc572bfb 100644 --- a/rpitx.py +++ b/rpitx.py @@ -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)