From 8cf26fadc35d7564f982870268ac3243c2d44564 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 24 Sep 2022 18:19:46 -0400 Subject: [PATCH 01/27] added i2c1 - 8 --- cubesatsim/cubesatsim.h | 1 + 1 file changed, 1 insertion(+) diff --git a/cubesatsim/cubesatsim.h b/cubesatsim/cubesatsim.h index 48d7c255..5517bc48 100644 --- a/cubesatsim/cubesatsim.h +++ b/cubesatsim/cubesatsim.h @@ -290,6 +290,7 @@ int frameTime; float axis[3], angle[3], volts_max[3], amps_max[3], batt, rotation_speed, period, tempS, temp_max, temp_min, eclipse; int i2c_bus0 = OFF, i2c_bus1 = OFF, i2c_bus3 = OFF, camera = OFF, sim_mode = FALSE, SafeMode = FALSE, rxAntennaDeployed = 0, txAntennaDeployed = 0; double eclipse_time; +bool i2c1, i2c2, i2c3,i2c4, i2c5, i2c6, i2c7, i2c8; float voltage[9], current[9], sensor[17], other[3]; char sensor_payload[500]; From 863d1d471bb0f0c4748c385bbe3ae93b656f2f98 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 24 Sep 2022 18:29:30 -0400 Subject: [PATCH 02/27] added i2c1 - 8 flags --- cubesatsim/cubesatsim.ino | 40 +++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 92cea3fe..eda71806 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -2214,7 +2214,7 @@ void read_ina219() float current_mA = 0; float loadvoltage = 0; - if (i2c_bus1) { + if (i2c1) { shuntvoltage = ina219_1_0x40.getShuntVoltage_mV(); busvoltage = ina219_1_0x40.getBusVoltage_V(); current_mA = ina219_1_0x40.getCurrent_mA(); @@ -2229,7 +2229,9 @@ void read_ina219() } voltage[0] = loadvoltage; current[0] = current_mA; - + } + + if (i2c2) { shuntvoltage = ina219_1_0x41.getShuntVoltage_mV(); busvoltage = ina219_1_0x41.getBusVoltage_V(); current_mA = ina219_1_0x41.getCurrent_mA(); @@ -2244,7 +2246,9 @@ void read_ina219() } voltage[1] = loadvoltage; current[1] = current_mA; + } + if (i2c3) { shuntvoltage = ina219_1_0x44.getShuntVoltage_mV(); busvoltage = ina219_1_0x44.getBusVoltage_V(); current_mA = ina219_1_0x44.getCurrent_mA(); @@ -2278,7 +2282,7 @@ void read_ina219() } - if (i2c_bus3) { + if (i2c5) { shuntvoltage = ina219_2_0x40.getShuntVoltage_mV(); busvoltage = ina219_2_0x40.getBusVoltage_V(); current_mA = ina219_2_0x40.getCurrent_mA(); @@ -2293,7 +2297,9 @@ void read_ina219() } voltage[4] = loadvoltage; current[4] = current_mA; - + } + + if (i2c6) { shuntvoltage = ina219_2_0x41.getShuntVoltage_mV(); busvoltage = ina219_2_0x41.getBusVoltage_V(); current_mA = ina219_2_0x41.getCurrent_mA(); @@ -2308,7 +2314,9 @@ void read_ina219() } voltage[5] = loadvoltage; current[5] = current_mA; + } + if (i2c7) { shuntvoltage = ina219_2_0x44.getShuntVoltage_mV(); busvoltage = ina219_2_0x44.getBusVoltage_V(); current_mA = ina219_2_0x44.getCurrent_mA(); @@ -2323,7 +2331,9 @@ void read_ina219() } voltage[6] = loadvoltage; current[6] = current_mA; - + } + + if (i2c8) { shuntvoltage = ina219_2_0x45.getShuntVoltage_mV(); busvoltage = ina219_2_0x45.getBusVoltage_V(); current_mA = ina219_2_0x45.getCurrent_mA(); @@ -2979,6 +2989,8 @@ void start_ina219() { Serial.println(PI_3V3_PIN); ina219_started = true; + i2c1 = i2c2 = i2c3 = i2c4 = i2c5 = i2c6 = i2c7 = i2c8 = false; + #ifndef PICO_0V1 // check if Pi is present by 3.3V voltage pinMode(PI_3V3_PIN, INPUT); @@ -2999,19 +3011,23 @@ void start_ina219() { #endif sleep(0.1); - i2c_bus1 = ina219_1_0x40.begin(); // check i2c bus 1 - ina219_1_0x41.begin(); - ina219_1_0x44.begin(); + i2c1 = ina219_1_0x40.begin(); // check i2c bus 1 + i2c2 = ina219_1_0x41.begin(); + i2c3 = ina219_1_0x44.begin(); // ina219_1_0x45.begin(); + + i2c_bus1 = i2c1 || i2c2 || i2c3 || i2c4; Wire1.setSDA(2); Wire1.setSCL(3); Wire1.begin(); - i2c_bus3 = ina219_2_0x40.begin(&Wire1); // check i2c bus 2 - ina219_2_0x41.begin(&Wire1); - ina219_2_0x44.begin(&Wire1); - ina219_2_0x45.begin(&Wire1); + i2c5 = ina219_2_0x40.begin(&Wire1); // check i2c bus 2 + i2c6 = ina219_2_0x41.begin(&Wire1); + i2c7 = ina219_2_0x44.begin(&Wire1); + i2c8 = ina219_2_0x45.begin(&Wire1); + + i2c_bus1 = i2c5 || i2c6 || i2c7 || i2c8; Serial.print("I2C bus 1: "); Serial.print(i2c_bus1); From 1e0f478eb83d05234e65ca5dd2b799c55109ce7f Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 24 Sep 2022 18:33:01 -0400 Subject: [PATCH 03/27] changed i2c1 to i2c0 --- cubesatsim/cubesatsim.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.h b/cubesatsim/cubesatsim.h index 5517bc48..ce3d41a9 100644 --- a/cubesatsim/cubesatsim.h +++ b/cubesatsim/cubesatsim.h @@ -290,7 +290,7 @@ int frameTime; float axis[3], angle[3], volts_max[3], amps_max[3], batt, rotation_speed, period, tempS, temp_max, temp_min, eclipse; int i2c_bus0 = OFF, i2c_bus1 = OFF, i2c_bus3 = OFF, camera = OFF, sim_mode = FALSE, SafeMode = FALSE, rxAntennaDeployed = 0, txAntennaDeployed = 0; double eclipse_time; -bool i2c1, i2c2, i2c3,i2c4, i2c5, i2c6, i2c7, i2c8; +bool i2c0, i2c2, i2c3,i2c4, i2c5, i2c6, i2c7, i2c8; float voltage[9], current[9], sensor[17], other[3]; char sensor_payload[500]; From 4cf9c1e400d7772317fc7d8147489c17b8be7288 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 24 Sep 2022 18:33:31 -0400 Subject: [PATCH 04/27] changed i2c1 to i2c0 --- cubesatsim/cubesatsim.ino | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index eda71806..5cf4bbf4 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -2214,7 +2214,7 @@ void read_ina219() float current_mA = 0; float loadvoltage = 0; - if (i2c1) { + if (i2c0) { shuntvoltage = ina219_1_0x40.getShuntVoltage_mV(); busvoltage = ina219_1_0x40.getBusVoltage_V(); current_mA = ina219_1_0x40.getCurrent_mA(); @@ -2989,7 +2989,7 @@ void start_ina219() { Serial.println(PI_3V3_PIN); ina219_started = true; - i2c1 = i2c2 = i2c3 = i2c4 = i2c5 = i2c6 = i2c7 = i2c8 = false; + i2c0 = i2c2 = i2c3 = i2c4 = i2c5 = i2c6 = i2c7 = i2c8 = false; #ifndef PICO_0V1 // check if Pi is present by 3.3V voltage @@ -3011,7 +3011,7 @@ void start_ina219() { #endif sleep(0.1); - i2c1 = ina219_1_0x40.begin(); // check i2c bus 1 + i2c0 = ina219_1_0x40.begin(); // check i2c bus 1 i2c2 = ina219_1_0x41.begin(); i2c3 = ina219_1_0x44.begin(); // ina219_1_0x45.begin(); From 62288eaf1d1f56237f5176808430476eaffc8c84 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 24 Sep 2022 18:34:14 -0400 Subject: [PATCH 05/27] fixed " typo --- cubesatsim/pico-get-jpeg-serial.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/pico-get-jpeg-serial.cpp b/cubesatsim/pico-get-jpeg-serial.cpp index 5057d64b..67842501 100644 --- a/cubesatsim/pico-get-jpeg-serial.cpp +++ b/cubesatsim/pico-get-jpeg-serial.cpp @@ -206,7 +206,7 @@ bool get_camera_image() { int received_crc = Serial2.read(); // buffer2[index1++] = octet; - Serial.print(nFile length: "); + Serial.print("File length: "); Serial.println(index1 - (int)strlen(end_flag)); // index1 -= 1; // 40; // Serial.println(buffer2[index1 - 1], HEX); From 149cc7051e7fc59a4619fada562534e1c7198674 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 24 Sep 2022 18:36:06 -0400 Subject: [PATCH 06/27] changed to i2c_1 --- cubesatsim/cubesatsim.ino | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 5cf4bbf4..ee55c2af 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -2214,7 +2214,7 @@ void read_ina219() float current_mA = 0; float loadvoltage = 0; - if (i2c0) { + if (i2c_1) { shuntvoltage = ina219_1_0x40.getShuntVoltage_mV(); busvoltage = ina219_1_0x40.getBusVoltage_V(); current_mA = ina219_1_0x40.getCurrent_mA(); @@ -2989,7 +2989,7 @@ void start_ina219() { Serial.println(PI_3V3_PIN); ina219_started = true; - i2c0 = i2c2 = i2c3 = i2c4 = i2c5 = i2c6 = i2c7 = i2c8 = false; + i2c_1 = i2c2 = i2c3 = i2c4 = i2c5 = i2c6 = i2c7 = i2c8 = false; #ifndef PICO_0V1 // check if Pi is present by 3.3V voltage @@ -3011,7 +3011,7 @@ void start_ina219() { #endif sleep(0.1); - i2c0 = ina219_1_0x40.begin(); // check i2c bus 1 + i2c_1 = ina219_1_0x40.begin(); // check i2c bus 1 i2c2 = ina219_1_0x41.begin(); i2c3 = ina219_1_0x44.begin(); // ina219_1_0x45.begin(); From 9badecdf2b4d5092d2e7226634a3948bddce8943 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 24 Sep 2022 18:36:19 -0400 Subject: [PATCH 07/27] i2c_1 --- cubesatsim/cubesatsim.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.h b/cubesatsim/cubesatsim.h index ce3d41a9..5c55230c 100644 --- a/cubesatsim/cubesatsim.h +++ b/cubesatsim/cubesatsim.h @@ -290,7 +290,7 @@ int frameTime; float axis[3], angle[3], volts_max[3], amps_max[3], batt, rotation_speed, period, tempS, temp_max, temp_min, eclipse; int i2c_bus0 = OFF, i2c_bus1 = OFF, i2c_bus3 = OFF, camera = OFF, sim_mode = FALSE, SafeMode = FALSE, rxAntennaDeployed = 0, txAntennaDeployed = 0; double eclipse_time; -bool i2c0, i2c2, i2c3,i2c4, i2c5, i2c6, i2c7, i2c8; +bool i2c_1, i2c2, i2c3,i2c4, i2c5, i2c6, i2c7, i2c8; float voltage[9], current[9], sensor[17], other[3]; char sensor_payload[500]; From 29a00437c5b8b0c55a6895891ed8b5c2092a2ed8 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 24 Sep 2022 18:49:05 -0400 Subject: [PATCH 08/27] displayed +X, etc for ina219 --- cubesatsim/cubesatsim.ino | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index ee55c2af..cf3c3a64 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -2221,7 +2221,7 @@ void read_ina219() loadvoltage = busvoltage + (shuntvoltage / 1000); if ((debug_mode) || (voltage_read)) { - Serial.print("1 0x40 Voltage: "); + Serial.print("+X (1 0x40) Voltage: "); Serial.print(loadvoltage); Serial.print("V Current: "); Serial.print(current_mA); @@ -2238,7 +2238,7 @@ void read_ina219() loadvoltage = busvoltage + (shuntvoltage / 1000); if ((debug_mode) || (voltage_read)) { - Serial.print("1 0x41 Voltage: "); + Serial.print("+Y (1 0x41) Voltage: "); Serial.print(loadvoltage); Serial.print("V Current: "); Serial.print(current_mA); @@ -2255,7 +2255,7 @@ void read_ina219() loadvoltage = busvoltage + (shuntvoltage / 1000); if ((debug_mode) || (voltage_read)) { - Serial.print("1 0x44 Voltage: "); + Serial.print("+Bat (1 0x44) Voltage: "); Serial.print(loadvoltage); Serial.print("V Current: "); Serial.print(current_mA); @@ -2289,7 +2289,7 @@ void read_ina219() loadvoltage = busvoltage + (shuntvoltage / 1000); if ((debug_mode) || (voltage_read)) { - Serial.print("2 0x40 Voltage: "); + Serial.print("+Z (2 0x40) Voltage: "); Serial.print(loadvoltage); Serial.print("V Current: "); Serial.print(current_mA); @@ -2306,7 +2306,7 @@ void read_ina219() loadvoltage = busvoltage + (shuntvoltage / 1000); if ((debug_mode) || (voltage_read)) { - Serial.print("2 0x41 Voltage: "); + Serial.print("-X (2 0x41) Voltage: "); Serial.print(loadvoltage); Serial.print("V Current: "); Serial.print(current_mA); @@ -2323,7 +2323,7 @@ void read_ina219() loadvoltage = busvoltage + (shuntvoltage / 1000); if ((debug_mode) || (voltage_read)) { - Serial.print("2 0x44 Voltage: "); + Serial.print("-Y (2 0x44) Voltage: "); Serial.print(loadvoltage); Serial.print("V Current: "); Serial.print(current_mA); @@ -2340,7 +2340,7 @@ void read_ina219() loadvoltage = busvoltage + (shuntvoltage / 1000); if ((debug_mode) || (voltage_read)) { - Serial.print("2 0x45 Voltage: "); + Serial.print("-Z (2 0x45) Voltage: "); Serial.print(loadvoltage); Serial.print("V Current: "); Serial.print(current_mA); From d57da325063c3b01c4a8301e018306e4934f9d07 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 24 Sep 2022 18:55:10 -0400 Subject: [PATCH 09/27] print when I2C devices not present --- cubesatsim/cubesatsim.ino | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index cf3c3a64..2c981d41 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -2306,7 +2306,7 @@ void read_ina219() loadvoltage = busvoltage + (shuntvoltage / 1000); if ((debug_mode) || (voltage_read)) { - Serial.print("-X (2 0x41) Voltage: "); + Serial.print("-X (2 0x41) Voltage: "); Serial.print(loadvoltage); Serial.print("V Current: "); Serial.print(current_mA); @@ -2323,7 +2323,7 @@ void read_ina219() loadvoltage = busvoltage + (shuntvoltage / 1000); if ((debug_mode) || (voltage_read)) { - Serial.print("-Y (2 0x44) Voltage: "); + Serial.print("-Y (2 0x44) Voltage: "); Serial.print(loadvoltage); Serial.print("V Current: "); Serial.print(current_mA); @@ -2340,7 +2340,7 @@ void read_ina219() loadvoltage = busvoltage + (shuntvoltage / 1000); if ((debug_mode) || (voltage_read)) { - Serial.print("-Z (2 0x45) Voltage: "); + Serial.print("-Z (2 0x45) Voltage: "); Serial.print(loadvoltage); Serial.print("V Current: "); Serial.print(current_mA); @@ -3011,9 +3011,12 @@ void start_ina219() { #endif sleep(0.1); - i2c_1 = ina219_1_0x40.begin(); // check i2c bus 1 - i2c2 = ina219_1_0x41.begin(); - i2c3 = ina219_1_0x44.begin(); + if (!i2c_1 = ina219_1_0x40.begin()) // check i2c bus 1 + Serial.println("I2C bus 1 0x40 not found"); + if (!i2c2 = ina219_1_0x41.begin()) + Serial.println("I2C bus 1 0x41 not found"); + if (!i2c3 = ina219_1_0x44.begin()) + Serial.println("I2C bus 1 0x44 not found"); // ina219_1_0x45.begin(); i2c_bus1 = i2c1 || i2c2 || i2c3 || i2c4; @@ -3022,12 +3025,16 @@ void start_ina219() { Wire1.setSCL(3); Wire1.begin(); - i2c5 = ina219_2_0x40.begin(&Wire1); // check i2c bus 2 - i2c6 = ina219_2_0x41.begin(&Wire1); - i2c7 = ina219_2_0x44.begin(&Wire1); - i2c8 = ina219_2_0x45.begin(&Wire1); + if (!i2c5 = ina219_2_0x40.begin(&Wire1)) // check i2c bus 2 + Serial.println("I2C bus 2 0x40 not found"); + if (!i2c6 = ina219_2_0x41.begin(&Wire1)) + Serial.println("I2C bus 2 0x41 not found"); + if (!i2c7 = ina219_2_0x44.begin(&Wire1)) + Serial.println("I2C bus 2 0x44 not found"); + if (!i2c8 = ina219_2_0x45.begin(&Wire1)) + Serial.println("I2C bus 2 0x45 not found"); - i2c_bus1 = i2c5 || i2c6 || i2c7 || i2c8; + i2c_bus3 = i2c5 || i2c6 || i2c7 || i2c8; Serial.print("I2C bus 1: "); Serial.print(i2c_bus1); From eb124a668a0c4ec1699d0d7ca1e7e9e7a324399c Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 24 Sep 2022 18:57:36 -0400 Subject: [PATCH 10/27] added () --- cubesatsim/cubesatsim.ino | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 2c981d41..df272b63 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -3011,11 +3011,11 @@ void start_ina219() { #endif sleep(0.1); - if (!i2c_1 = ina219_1_0x40.begin()) // check i2c bus 1 + if (!(i2c_1 = ina219_1_0x40.begin())) // check i2c bus 1 Serial.println("I2C bus 1 0x40 not found"); - if (!i2c2 = ina219_1_0x41.begin()) + if (!(i2c2 = ina219_1_0x41.begin())) Serial.println("I2C bus 1 0x41 not found"); - if (!i2c3 = ina219_1_0x44.begin()) + if (!(i2c3 = ina219_1_0x44.begin())) Serial.println("I2C bus 1 0x44 not found"); // ina219_1_0x45.begin(); @@ -3025,13 +3025,13 @@ void start_ina219() { Wire1.setSCL(3); Wire1.begin(); - if (!i2c5 = ina219_2_0x40.begin(&Wire1)) // check i2c bus 2 + if (!(i2c5 = ina219_2_0x40.begin(&Wire1))) // check i2c bus 2 Serial.println("I2C bus 2 0x40 not found"); - if (!i2c6 = ina219_2_0x41.begin(&Wire1)) + if (!(i2c6 = ina219_2_0x41.begin(&Wire1))) Serial.println("I2C bus 2 0x41 not found"); - if (!i2c7 = ina219_2_0x44.begin(&Wire1)) + if (!(i2c7 = ina219_2_0x44.begin(&Wire1))) Serial.println("I2C bus 2 0x44 not found"); - if (!i2c8 = ina219_2_0x45.begin(&Wire1)) + if (!(i2c8 = ina219_2_0x45.begin(&Wire1))) Serial.println("I2C bus 2 0x45 not found"); i2c_bus3 = i2c5 || i2c6 || i2c7 || i2c8; From 703979e7b3f0354aa63c548c649d43c7d7a7d011 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 24 Sep 2022 22:20:19 -0400 Subject: [PATCH 11/27] added more detail in I2C sensor failures --- cubesatsim/cubesatsim.ino | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index df272b63..93266e83 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -3012,11 +3012,11 @@ void start_ina219() { sleep(0.1); if (!(i2c_1 = ina219_1_0x40.begin())) // check i2c bus 1 - Serial.println("I2C bus 1 0x40 not found"); + Serial.println("I2C +X sensor (bus 1 0x40) not found"); if (!(i2c2 = ina219_1_0x41.begin())) - Serial.println("I2C bus 1 0x41 not found"); + Serial.println("I2C +Y sensor (bus 1 0x41) not found"); if (!(i2c3 = ina219_1_0x44.begin())) - Serial.println("I2C bus 1 0x44 not found"); + Serial.println("I2C Batt sensor (bus 1 0x44) not found"); // ina219_1_0x45.begin(); i2c_bus1 = i2c1 || i2c2 || i2c3 || i2c4; @@ -3026,13 +3026,13 @@ void start_ina219() { Wire1.begin(); if (!(i2c5 = ina219_2_0x40.begin(&Wire1))) // check i2c bus 2 - Serial.println("I2C bus 2 0x40 not found"); + Serial.println("I2C +Z sensor (bus 2 0x40) not found"); if (!(i2c6 = ina219_2_0x41.begin(&Wire1))) - Serial.println("I2C bus 2 0x41 not found"); + Serial.println("I2C -X sensor (bus 2 0x41) not found"); if (!(i2c7 = ina219_2_0x44.begin(&Wire1))) - Serial.println("I2C bus 2 0x44 not found"); + Serial.println("I2C -Y sensor (bus 2 0x44) not found"); if (!(i2c8 = ina219_2_0x45.begin(&Wire1))) - Serial.println("I2C bus 2 0x45 not found"); + Serial.println("I2C -Z sensor (bus 2 0x45) not found"); i2c_bus3 = i2c5 || i2c6 || i2c7 || i2c8; From aff5693a788833eee8cc112449052adb81f079a0 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 24 Sep 2022 22:47:17 -0400 Subject: [PATCH 12/27] moved +Z up to position 4 to match schematic --- cubesatsim/cubesatsim.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cubesatsim/cubesatsim.h b/cubesatsim/cubesatsim.h index 5c55230c..a33b48fe 100644 --- a/cubesatsim/cubesatsim.h +++ b/cubesatsim/cubesatsim.h @@ -90,9 +90,9 @@ #define PLUS_Y 1 #define BAT 2 #define BUS 3 -#define MINUS_X 4 -#define MINUS_Y 5 -#define PLUS_Z 6 +#define MINUS_X 5 // 4 +#define MINUS_Y 6 // 5 +#define PLUS_Z 4 // 6 #define MINUS_Z 7 #define TEMP 2 #define PRES 3 From ba257eb1b9dfb3cad536410f41e68588f93a32a5 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 24 Sep 2022 22:52:04 -0400 Subject: [PATCH 13/27] set missing ina219 to zero, BUS same as BAT --- cubesatsim/cubesatsim.ino | 84 ++++++++++++++++++++++++--------------- 1 file changed, 53 insertions(+), 31 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 93266e83..aad202d9 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -2215,20 +2215,23 @@ void read_ina219() float loadvoltage = 0; if (i2c_1) { - shuntvoltage = ina219_1_0x40.getShuntVoltage_mV(); - busvoltage = ina219_1_0x40.getBusVoltage_V(); - current_mA = ina219_1_0x40.getCurrent_mA(); - loadvoltage = busvoltage + (shuntvoltage / 1000); - - if ((debug_mode) || (voltage_read)) { - Serial.print("+X (1 0x40) Voltage: "); - Serial.print(loadvoltage); - Serial.print("V Current: "); - Serial.print(current_mA); - Serial.println(" mA"); - } - voltage[0] = loadvoltage; - current[0] = current_mA; + shuntvoltage = ina219_1_0x40.getShuntVoltage_mV(); + busvoltage = ina219_1_0x40.getBusVoltage_V(); + current_mA = ina219_1_0x40.getCurrent_mA(); + loadvoltage = busvoltage + (shuntvoltage / 1000); + + if ((debug_mode) || (voltage_read)) { + Serial.print("+X (1 0x40) Voltage: "); + Serial.print(loadvoltage); + Serial.print("V Current: "); + Serial.print(current_mA); + Serial.println(" mA"); + } + voltage[PLUS_X] = loadvoltage; + current[PLUS_X] = current_mA; + } else { + voltage[PLUS_X] = 0.0; + current[PLUS_X] = 0.0; } if (i2c2) { @@ -2244,8 +2247,11 @@ void read_ina219() Serial.print(current_mA); Serial.println(" mA"); } - voltage[1] = loadvoltage; - current[1] = current_mA; + voltage[PLUS_Y] = loadvoltage; + current[PLUS_Y] = current_mA; + } else { + voltage[PLUS_Y] = 0.0; + current[PLUS_Y] = 0.0; } if (i2c3) { @@ -2261,8 +2267,8 @@ void read_ina219() Serial.print(current_mA); Serial.println(" mA"); } - voltage[2] = loadvoltage; - current[2] = current_mA; + voltage[BATT] = loadvoltage; + current[BATT] = current_mA; /* shuntvoltage = ina219_1_0x45.getShuntVoltage_mV(); busvoltage = ina219_1_0x45.getBusVoltage_V(); @@ -2276,10 +2282,14 @@ void read_ina219() Serial.print(current_mA); Serial.println(" mA"); } - voltage[3] = loadvoltage; - current[3] = current_mA; -*/ +*/ + voltage[BUS] = loadvoltage; // since battery directly supplies, make BUS same as BAT for FoxTelem + current[BUS] = current_mA; + + } else { + voltage[BATT] = 0.0; + current[BATT] = 0.0; } if (i2c5) { @@ -2295,8 +2305,11 @@ void read_ina219() Serial.print(current_mA); Serial.println(" mA"); } - voltage[4] = loadvoltage; - current[4] = current_mA; + voltage[PLUS_Z] = loadvoltage; + current[PLUS_Z] = current_mA; + } else { + voltage[PLUS_Z] = 0.0; + current[PLUS_Z] = 0.0; } if (i2c6) { @@ -2312,8 +2325,11 @@ void read_ina219() Serial.print(current_mA); Serial.println(" mA"); } - voltage[5] = loadvoltage; - current[5] = current_mA; + voltage[MINUS_X] = loadvoltage; + current[MINUS_X] = current_mA; + } else { + voltage[MINUS_X] = 0.0; + current[MINUS_X] = 0.0; } if (i2c7) { @@ -2329,8 +2345,11 @@ void read_ina219() Serial.print(current_mA); Serial.println(" mA"); } - voltage[6] = loadvoltage; - current[6] = current_mA; + voltage[MINUS_Y] = loadvoltage; + current[MINUS_Y] = current_mA; + } else { + voltage[MINUS_Y] = 0.0; + current[MINUS_Y] = 0.0; } if (i2c8) { @@ -2346,9 +2365,12 @@ void read_ina219() Serial.print(current_mA); Serial.println(" mA"); } - voltage[7] = loadvoltage; - current[7] = current_mA; - } + voltage[MINUS_Z] = loadvoltage; + current[MINUS_Z] = current_mA; + } else { + voltage[MINUS_Z] = 0.0; + current[MINUS_Z] = 0.0; + } voltage_read = false; } @@ -2998,7 +3020,7 @@ void start_ina219() { // Serial.println(digitalRead(PI_3V3_PIN)); if (digitalRead(PI_3V3_PIN) == LOW) { // if (true) { - Serial.println("Pi Zero not present, powering INA219s through 3.3V pin"); + Serial.println("Pico powering INA219s through 3.3V pin"); pinMode(PI_3V3_PIN, OUTPUT); digitalWrite(PI_3V3_PIN, HIGH); } else { From e87f22d0b6ebfedafa183db4402ebd579c4f0270 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 24 Sep 2022 22:53:47 -0400 Subject: [PATCH 14/27] BATT to BAT --- cubesatsim/cubesatsim.ino | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index aad202d9..5c6dc885 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -2267,8 +2267,8 @@ void read_ina219() Serial.print(current_mA); Serial.println(" mA"); } - voltage[BATT] = loadvoltage; - current[BATT] = current_mA; + voltage[BAT] = loadvoltage; + current[BAT] = current_mA; /* shuntvoltage = ina219_1_0x45.getShuntVoltage_mV(); busvoltage = ina219_1_0x45.getBusVoltage_V(); @@ -2288,8 +2288,8 @@ void read_ina219() } else { - voltage[BATT] = 0.0; - current[BATT] = 0.0; + voltage[BAT] = 0.0; + current[BAT] = 0.0; } if (i2c5) { From 265e819b5c7444316644f8d38cec54cd1353a0bb Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 24 Sep 2022 23:01:54 -0400 Subject: [PATCH 15/27] removed i2c4 from i2c_bus1 determination --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 5c6dc885..b04380de 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -3041,7 +3041,7 @@ void start_ina219() { Serial.println("I2C Batt sensor (bus 1 0x44) not found"); // ina219_1_0x45.begin(); - i2c_bus1 = i2c1 || i2c2 || i2c3 || i2c4; + i2c_bus1 = i2c1 || i2c2 || i2c3; Wire1.setSDA(2); Wire1.setSCL(3); From 1cc6faf4a2ca8745ed407c74eb7bab4e63f0c4d7 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 24 Sep 2022 23:06:01 -0400 Subject: [PATCH 16/27] fixed i2c_bus1 calculation --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index b04380de..ba5e7c7f 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -3041,7 +3041,7 @@ void start_ina219() { Serial.println("I2C Batt sensor (bus 1 0x44) not found"); // ina219_1_0x45.begin(); - i2c_bus1 = i2c1 || i2c2 || i2c3; + i2c_bus1 = i2c_1 || i2c2 || i2c3; Wire1.setSDA(2); Wire1.setSCL(3); From a648f8d4ea1a09e981f5ba9481acbfbb36ed2ce8 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 24 Sep 2022 23:13:51 -0400 Subject: [PATCH 17/27] set payload to true if bme or mph present --- cubesatsim/cubesatsim.ino | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index ba5e7c7f..db2db827 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -2450,6 +2450,8 @@ void start_payload() { mpuPresent = 1; mpu6050.begin(); + payload = bmePresent || mpuPresent; + long flag; float xOffset; float yOffset; From 4fc6da7bfc068686050a11661f56f6d5afcb0539 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 24 Sep 2022 23:22:40 -0400 Subject: [PATCH 18/27] set payload --- cubesatsim/cubesatsim.ino | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index db2db827..b931888b 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -1038,7 +1038,10 @@ void get_tlm_fox() { Serial.println(posXv); */ // if (payload == ON) - STEMBoardFailure = 0; +// STEMBoardFailure = 0; + + STEMBoardFailure = !payload; + // read payload sensor if available // Serial.println("Before encoding"); encodeA(b, 0 + head_offset, batt_a_v); From 8f964a2374205ceb7eeb33d30b85b983398c8c5a Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 24 Sep 2022 23:26:16 -0400 Subject: [PATCH 19/27] fixed payload status in FoxTelem --- cubesatsim/cubesatsim.ino | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index b931888b..6fba1308 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -1037,10 +1037,10 @@ void get_tlm_fox() { Serial.print("posXv = "); Serial.println(posXv); */ -// if (payload == ON) -// STEMBoardFailure = 0; - - STEMBoardFailure = !payload; + if (payload == ON) + STEMBoardFailure = 0; + else + STEMBoardFailure = 1; // read payload sensor if available // Serial.println("Before encoding"); From 28917e36e00b52ecdfb4a5faef596a69235511f4 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 24 Sep 2022 23:35:48 -0400 Subject: [PATCH 20/27] moved payload setting --- cubesatsim/cubesatsim.ino | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 6fba1308..0c44ded7 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -2452,8 +2452,6 @@ void start_payload() { else { mpuPresent = 1; mpu6050.begin(); - - payload = bmePresent || mpuPresent; long flag; float xOffset; @@ -2516,7 +2514,10 @@ void start_payload() { EEPROM.get(12, f); Serial.println(f); } - } + } + + payload = bmePresent || mpuPresent; + pinMode(greenLED, OUTPUT); pinMode(blueLED, OUTPUT); From d77d7e756f63e7ecff95cffaf9d68a81440c263e Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 25 Sep 2022 10:31:52 -0400 Subject: [PATCH 21/27] log if no payload sensors detected --- cubesatsim/cubesatsim.ino | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 0c44ded7..ea2bd52f 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -2516,7 +2516,8 @@ void start_payload() { } } - payload = bmePresent || mpuPresent; + if (!(payload = bmePresent || mpuPresent)) + Serial.println("No payload sensors detected"); pinMode(greenLED, OUTPUT); pinMode(blueLED, OUTPUT); From bfde926bf3fd8c797ecdaa710b85af166395a6ec Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 25 Sep 2022 10:41:15 -0400 Subject: [PATCH 22/27] cleanup --- cubesatsim/cubesatsim.ino | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index ea2bd52f..3cddb76c 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -571,7 +571,7 @@ void config_telem() { Serial.println("Configuring for FSK\n"); bitRate = 200; delay_time = 1E6 / bitRate; - Serial.println(delay_time); +// Serial.println(delay_time); rsFrames = 1; payloads = 1; rsFrameLen = 64; @@ -587,13 +587,13 @@ void config_telem() { // Serial.println(samples); bufLen = (frameCnt * (syncBits + 10 * (headerLen + rsFrames * (rsFrameLen + parityLen))) * samples); bufLen = 970; // 2000; - Serial.println(bufLen); +// Serial.println(bufLen); samplePeriod = (int) (((float)((syncBits + 10 * (headerLen + rsFrames * (rsFrameLen + parityLen)))) / (float) bitRate) * 1000 - 500); sleepTime = 0.1; // Serial.println(samplePeriod); frameTime = ((float)((float)bufLen / (samples * frameCnt * bitRate))) * 1000; // frame time in ms - Serial.println(frameTime); +// Serial.println(frameTime); // printf("\n FSK Mode, %d bits per frame, %d bits per second, %d ms per frame, %d ms sample period\n", // bufLen / (samples * frameCnt), bitRate, frameTime, samplePeriod); memset(buffer, 0xa5, sizeof(buffer)); @@ -602,7 +602,7 @@ void config_telem() { bitRate = 1200; // delay_time = (1.0 / 1200.0); delay_time = 1E6 / bitRate; - Serial.println(delay_time); +// Serial.println(delay_time); rsFrames = 3; payloads = 6; rsFrameLen = 159; @@ -2226,7 +2226,7 @@ void read_ina219() if ((debug_mode) || (voltage_read)) { Serial.print("+X (1 0x40) Voltage: "); Serial.print(loadvoltage); - Serial.print("V Current: "); + Serial.print("V Current: "); Serial.print(current_mA); Serial.println(" mA"); } @@ -2246,7 +2246,7 @@ void read_ina219() if ((debug_mode) || (voltage_read)) { Serial.print("+Y (1 0x41) Voltage: "); Serial.print(loadvoltage); - Serial.print("V Current: "); + Serial.print("V Current: "); Serial.print(current_mA); Serial.println(" mA"); } @@ -2266,7 +2266,7 @@ void read_ina219() if ((debug_mode) || (voltage_read)) { Serial.print("+Bat (1 0x44) Voltage: "); Serial.print(loadvoltage); - Serial.print("V Current: "); + Serial.print("V Current: "); Serial.print(current_mA); Serial.println(" mA"); } @@ -2281,7 +2281,7 @@ void read_ina219() if ((debug_mode) || (voltage_read)) { Serial.print("1 0x45 Voltage: "); Serial.print(loadvoltage); - Serial.print("V Current: "); + Serial.print("V Current: "); Serial.print(current_mA); Serial.println(" mA"); } @@ -2304,7 +2304,7 @@ void read_ina219() if ((debug_mode) || (voltage_read)) { Serial.print("+Z (2 0x40) Voltage: "); Serial.print(loadvoltage); - Serial.print("V Current: "); + Serial.print("V Current: "); Serial.print(current_mA); Serial.println(" mA"); } @@ -2324,7 +2324,7 @@ void read_ina219() if ((debug_mode) || (voltage_read)) { Serial.print("-X (2 0x41) Voltage: "); Serial.print(loadvoltage); - Serial.print("V Current: "); + Serial.print("V Current: "); Serial.print(current_mA); Serial.println(" mA"); } @@ -2344,7 +2344,7 @@ void read_ina219() if ((debug_mode) || (voltage_read)) { Serial.print("-Y (2 0x44) Voltage: "); Serial.print(loadvoltage); - Serial.print("V Current: "); + Serial.print("V Current: "); Serial.print(current_mA); Serial.println(" mA"); } @@ -2364,7 +2364,7 @@ void read_ina219() if ((debug_mode) || (voltage_read)) { Serial.print("-Z (2 0x45) Voltage: "); Serial.print(loadvoltage); - Serial.print("V Current: "); + Serial.print("V Current: "); Serial.print(current_mA); Serial.println(" mA"); } @@ -4421,7 +4421,7 @@ void start_clockgen() { if (clockgen.begin() != ERROR_NONE) { /* There was a problem detecting the IC ... check your connections */ - Serial.print("No Si5351 detected ... Check your wiring or I2C ADDR!"); + Serial.println("No Si5351 detected ... Check your wiring or I2C ADDR!"); return; } From 54dd5c56d93397cd8c04fe89d3b076ac71f7af3b Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 25 Sep 2022 10:48:51 -0400 Subject: [PATCH 23/27] more cleanup --- cubesatsim/cubesatsim.ino | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 3cddb76c..1b1e203f 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -568,7 +568,7 @@ void config_telem() { transmit = TRUE; if (mode == FSK) { - Serial.println("Configuring for FSK\n"); + Serial.println("\nConfiguring for FSK"); bitRate = 200; delay_time = 1E6 / bitRate; // Serial.println(delay_time); @@ -598,7 +598,7 @@ void config_telem() { // bufLen / (samples * frameCnt), bitRate, frameTime, samplePeriod); memset(buffer, 0xa5, sizeof(buffer)); } else if (mode == BPSK) { - Serial.println("Configuring for BPSK\n"); + Serial.println("\nConfiguring for BPSK"); bitRate = 1200; // delay_time = (1.0 / 1200.0); delay_time = 1E6 / bitRate; @@ -642,7 +642,7 @@ void config_telem() { memset(buffer, 0xa5, sizeof(buffer)); } else if (mode == AFSK) { - Serial.println("Configuring for AFSK\n"); + Serial.println("\nConfiguring for AFSK"); set_pin(AUDIO_OUT_PIN); @@ -655,13 +655,13 @@ void config_telem() { frameTime = 5000; bufLen = 1000; } else if (mode == SSTV) { - Serial.println("Configuring for SSTV\n"); + Serial.println("\nConfiguring for SSTV"); set_sstv_pin(AUDIO_OUT_PIN); samplePeriod = 5000; frameTime = 5000; bufLen = 1000; } else if (mode == CW) { - Serial.println("Configuring for CW\n"); + Serial.println("\nConfiguring for CW"); } // clearing min and max values if (debug_mode) @@ -826,7 +826,7 @@ void config_simulated_telem() { sim_mode = TRUE; - Serial.println("Simulated telemetry mode!\n"); + Serial.println("Simulated telemetry mode!"); // srand((unsigned int)time(0)); From b4ceadca6ec928b25e3203d117134dc225254f11 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 25 Sep 2022 10:52:16 -0400 Subject: [PATCH 24/27] added payload and in1219 start to restart --- cubesatsim/cubesatsim.ino | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 1b1e203f..8b7ef1f0 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -4268,12 +4268,14 @@ void prompt_for_input() { case PROMPT_RESTART: prompt = false; // Serial.println("Restart not yet implemented"); + start_payload(); + start_ina219(); if (mode != CW) - transmit_callsign(callsign); - sleep(0.5); - config_telem(); - config_radio(); - sampleTime = (unsigned int) millis(); + transmit_callsign(callsign); + sleep(0.5); + config_telem(); + config_radio(); + sampleTime = (unsigned int) millis(); break; case PROMPT_DEBUG: From dcf8fa75797026098b9bf80f2432e817a008df1e Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 25 Sep 2022 10:59:24 -0400 Subject: [PATCH 25/27] don't check for 3V3 if already started --- cubesatsim/cubesatsim.ino | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 8b7ef1f0..379660ff 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -3015,11 +3015,12 @@ void led_set(int ledPin, bool state) void start_ina219() { //#define PI_3V3_PIN 9 // for v0.1 hardware Serial.println("Starting INA219"); - Serial.println(PI_3V3_PIN); - ina219_started = true; +// Serial.println(PI_3V3_PIN); + i2c_1 = i2c2 = i2c3 = i2c4 = i2c5 = i2c6 = i2c7 = i2c8 = false; - + + if (!ina219_started) { #ifndef PICO_0V1 // check if Pi is present by 3.3V voltage pinMode(PI_3V3_PIN, INPUT); @@ -3038,7 +3039,7 @@ void start_ina219() { pinMode(PI_3V3_PIN, OUTPUT); digitalWrite(PI_3V3_PIN, HIGH); #endif - + } sleep(0.1); if (!(i2c_1 = ina219_1_0x40.begin())) // check i2c bus 1 Serial.println("I2C +X sensor (bus 1 0x40) not found"); @@ -3084,6 +3085,7 @@ void start_ina219() { ina219_2_0x45.setCalibration_16V_400mA(); } */ + ina219_started = true; } void start_pwm() { From 1eca4121f149a8b27af87a455b14f019301b5097 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 25 Sep 2022 11:04:30 -0400 Subject: [PATCH 26/27] removed start_ina219 in restart --- cubesatsim/cubesatsim.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 379660ff..6de46180 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -4271,7 +4271,7 @@ void prompt_for_input() { prompt = false; // Serial.println("Restart not yet implemented"); start_payload(); - start_ina219(); +// start_ina219(); if (mode != CW) transmit_callsign(callsign); sleep(0.5); From ccb32201c67c5302ab94bff5dc6727514da6a334 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 25 Sep 2022 11:41:39 -0400 Subject: [PATCH 27/27] added I2C sensor problem print if longer than 1 second --- cubesatsim/cubesatsim.ino | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 6de46180..f7eb55a0 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -2205,6 +2205,8 @@ void test_radio() void read_ina219() { + unsigned long read_time = millis(); + if (voltage_read && !i2c_bus1 && !i2c_bus3) Serial.println("Nothing to read"); /* @@ -2375,6 +2377,9 @@ void read_ina219() current[MINUS_Z] = 0.0; } voltage_read = false; + + if ((millis() - read_time) > 1000) + Serial.println("There is an I2C sensor problem"); } void read_sensors()