minor edits

pico-v0.1
alanbjohnston 3 years ago committed by GitHub
parent c0c37961f2
commit 11712329b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -66,6 +66,17 @@ void setup() {
config_gpio(); config_gpio();
#ifndef ARDUINO_ARCH_RP2040
Serial.println("This code is written for the Raspberry Pi Pico hardware.");
#endif
// detect Pi Zero using 3.3V
// if Pi is present, run Payload OK software
// otherwise, run CubeSatSim Pico code
Serial.println("\n\nCubeSatSim Pico v0.1 starting...\n\n");
/* /*
pinMode(PI_3V3_PIN, INPUT); pinMode(PI_3V3_PIN, INPUT);
Serial.print("Pi 3.3V: "); Serial.print("Pi 3.3V: ");
@ -78,36 +89,22 @@ void setup() {
} }
} }
*/ */
// configure STEM Payload sensors
start_payload(); // above code not working, so forcing it start_payload(); // above code not working, so forcing it
read_reset_count(); read_reset_count();
// mode = FSK; // AFSK;
#ifndef ARDUINO_ARCH_RP2040
Serial.println("This code is written for the Raspberry Pi Pico hardware.");
#endif
// detect Pi Zero using 3.3V
// if Pi is present, run Payload OK software
// otherwise, run CubeSatSim Pico code
Serial.println("\n\nCubeSatSim Pico v0.1 starting...\n\n");
sim_mode = FALSE; sim_mode = FALSE;
if (sim_mode) if (sim_mode)
config_simulated_telem(); config_simulated_telem();
else else
; // configure ina219s ; // configure ina219s
start_ina219(); start_ina219();
config_telem(); config_telem();
// configure STEM Payload sensors // setup radio depending on mode
// start_payload();
// program Transceiver board
config_radio(); config_radio();
/* /*
if (check_for_wifi()) { if (check_for_wifi()) {
@ -142,7 +139,6 @@ void loop() {
generate_simulated_telem(); generate_simulated_telem();
else else
// query INA219 sensors and Payload sensors // query INA219 sensors and Payload sensors
// ; //
read_ina219(); read_ina219();
read_payload(); read_payload();
@ -170,14 +166,14 @@ void loop() {
digitalWrite(MAIN_LED_BLUE, LOW); digitalWrite(MAIN_LED_BLUE, LOW);
// delay(3000); // delay(3000);
sleep(0.5); // 2.845); // 3.0); sleep(0.2); // 2.845); // 3.0);
if (!wifi) if (!wifi)
digitalWrite(LED_BUILTIN, HIGH); digitalWrite(LED_BUILTIN, HIGH);
digitalWrite(MAIN_LED_BLUE, HIGH); digitalWrite(MAIN_LED_BLUE, HIGH);
} }
// send telemetry
// check to see if the mode has changed
if (mode != new_mode) { if (mode != new_mode) {
Serial.println("Changing mode"); Serial.println("Changing mode");
mode = new_mode; // change modes if button pressed mode = new_mode; // change modes if button pressed
@ -201,7 +197,6 @@ bool TimerHandler1(struct repeating_timer *t) {
check_for_browser(); check_for_browser();
return(true); return(true);
} }
void read_reset_count() { void read_reset_count() {
@ -242,7 +237,6 @@ void read_reset_count() {
} }
void send_packet() { void send_packet() {
// encode telemetry // encode telemetry
get_tlm_ao7(); get_tlm_ao7();
@ -252,11 +246,6 @@ void send_packet() {
transmit_on(); transmit_on();
send_packet(_FIXPOS_STATUS); send_packet(_FIXPOS_STATUS);
transmit_off(); transmit_off();
// delay(1000);
// digitalWrite(LED_BUILTIN, HIGH);
} }
void transmit_on() { void transmit_on() {
@ -386,6 +375,7 @@ void config_telem() {
} }
// clearing min and max values // clearing min and max values
Serial.println("Clearing min and max telemetry values");
for (int i = 0; i < 9; i++) { for (int i = 0; i < 9; i++) {
voltage_min[i] = 1000.0; voltage_min[i] = 1000.0;
@ -403,7 +393,6 @@ void config_telem() {
other_max[i] = -1000.0; other_max[i] = -1000.0;
} }
firstTime = TRUE; firstTime = TRUE;
} }
@ -545,7 +534,6 @@ void generate_simulated_telem() {
void config_simulated_telem() void config_simulated_telem()
{ {
sim_mode = TRUE; sim_mode = TRUE;
Serial.println("Simulated telemetry mode!\n"); Serial.println("Simulated telemetry mode!\n");
@ -593,7 +581,7 @@ void config_simulated_telem()
eclipse_time -= period / 2; // if starting in eclipse, shorten interval eclipse_time -= period / 2; // if starting in eclipse, shorten interval
// } // }
tx_freq_hz -= tx_channel * 50000; // tx_freq_hz -= tx_channel * 50000;
} }
@ -3429,8 +3417,8 @@ void parse_payload() {
for (count1 = 0; count1 < 17; count1++) { for (count1 = 0; count1 < 17; count1++) {
if (token != NULL) { if (token != NULL) {
sensor[count1] = (float) atof(token); sensor[count1] = (float) atof(token);
Serial.print("sensor: "); // Serial.print("sensor: ");
Serial.println(sensor[count1]); // Serial.println(sensor[count1]);
token = strtok(NULL, space); token = strtok(NULL, space);
} }
} }

Loading…
Cancel
Save

Powered by TurnKey Linux.