From b49fe72090c29fbe934c9d0af76df4c0c61ef155 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 31 Dec 2022 01:44:39 -0500 Subject: [PATCH] move Pi Zero detect code to config_gpio --- cubesatsim/cubesatsim.ino | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index fe1d9ab9..93e73dc7 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -116,19 +116,19 @@ void setup() { // if Pi is present, run Payload OK software /// load_files(); -/**/ +/* pinMode(PI_3V3_PIN, INPUT); Serial.print("Pi 3.3V: "); Serial.println(digitalRead(PI_3V3_PIN)); -// if (digitalRead(PI_3V3_PIN) == HIGH) { - { + if (digitalRead(PI_3V3_PIN) == HIGH) { +// { Serial.print("Pi Zero present, so running Payload OK code instead of CubeSatSim code."); start_payload(); while(true) { // payload_OK_only(); } } -/**/ +*/ // configure STEM Payload sensors // pinMode(PI_3V3_PIN, OUTPUT); @@ -3609,6 +3609,19 @@ void config_gpio() { for (int i = 6; i < 29; i++) { pinMode(i, INPUT); } + + pinMode(PI_3V3_PIN, INPUT); + Serial.print("Pi 3.3V: "); + Serial.println(digitalRead(PI_3V3_PIN)); +// if (digitalRead(PI_3V3_PIN) == HIGH) { + { + Serial.print("Pi Zero present, so running Payload OK code instead of CubeSatSim code."); + start_payload(); + while(true) { +// payload_OK_only(); + } + } + // set audio out to TXC board pinMode(AUDIO_OUT_PIN, OUTPUT);