From f720278ce41e67ea28765d1f18c0401864b9c591 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 6 Jul 2019 16:51:06 -0400 Subject: [PATCH] Update main.c --- afsk/main.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/afsk/main.c b/afsk/main.c index 0ad6ab1b..b60f8db7 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -440,7 +440,7 @@ int get_tlm(int tlm[][5]) { } int count; - for (count = 0; count < 8; count++) + for (count = 0; count < 7; count++) { if (sensor[count] != OFF) { @@ -460,7 +460,27 @@ int get_tlm(int tlm[][5]) { printf(" sensor[%d] voltsBus %4.2f voltsShunt %4.2f current %4.2f power %4.2f \n", count, voltsBus[count], voltsShunt[count], current[count], power[count]); } + if (sensor[count] != OFF) // count = 7 MoPower V2 INA219 + { + setCalibration_16V_400mA(sensor[count]); + voltsShunt[count] = getShuntVoltage_mV(sensor[count])/1000; + voltsBus[count] = getBusVoltage_V(sensor[count]); + current[count] = getCurrent_mA(sensor[count]) * 4; + power[count] = getPower_mW(sensor[count]) *2; + } + else + { + voltsShunt[count] = 0; + voltsBus[count] = 0; + current[count] = 0; + power[count] = 0; + } + printf(" sensor[%d] voltsBus %4.2f voltsShunt %4.2f current %4.2f power %4.2f \n", + count, voltsBus[count], voltsShunt[count], current[count], power[count]); + + + // delay(500); // }