diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index 2a8bb3b7..45526b74 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -257,19 +257,19 @@ void get_tlm_fox() { posXi = (int)(current[mapping[PLUS_X]] + 0.5) + 2048; posYi = (int)(current[mapping[PLUS_Y]] + 0.5) + 2048; posZi = (int)(current[mapping[PLUS_Z]] + 0.5) + 2048; - negXi = (int)(current[map[MINUS_X]] + 0.5) + 2048; - negYi = (int)(current[map[MINUS_Y]] + 0.5) + 2048; - negZi = (int)(current[map[MINUS_Z]] + 0.5) + 2048; - posXv = (int)(voltage[map[PLUS_X]] * 100); - posYv = (int)(voltage[map[PLUS_Y]] * 100); - posZv = (int)(voltage[map[PLUS_Z]] * 100); - negXv = (int)(voltage[map[MINUS_X]] * 100); - negYv = (int)(voltage[map[MINUS_Y]] * 100); - negZv = (int)(voltage[map[MINUS_Z]] * 100); - batt_c_v = (int)(voltage[map[BAT]] * 100); - battCurr = (int)(current[map[BAT]] + 0.5) + 2048; - PSUVoltage = (int)(voltage[map[BUS]] * 100); - PSUCurrent = (int)(current[map[BUS]] + 0.5) + 2048; + negXi = (int)(current[mapping[MINUS_X]] + 0.5) + 2048; + negYi = (int)(current[mapping[MINUS_Y]] + 0.5) + 2048; + negZi = (int)(current[mapping[MINUS_Z]] + 0.5) + 2048; + posXv = (int)(voltage[mapping[PLUS_X]] * 100); + posYv = (int)(voltage[mapping[PLUS_Y]] * 100); + posZv = (int)(voltage[mapping[PLUS_Z]] * 100); + negXv = (int)(voltage[mapping[MINUS_X]] * 100); + negYv = (int)(voltage[mapping[MINUS_Y]] * 100); + negZv = (int)(voltage[mapping[MINUS_Z]] * 100); + batt_c_v = (int)(voltage[mapping[BAT]] * 100); + battCurr = (int)(current[mapping[BAT]] + 0.5) + 2048; + PSUVoltage = (int)(voltage[mapping[BUS]] * 100); + PSUCurrent = (int)(current[mapping[BUS]] + 0.5) + 2048; if (payload == ON) STEMBoardFailure = 0; // read payload sensor if available @@ -309,22 +309,22 @@ void get_tlm_fox() { encodeA(b, 27 + head_offset, negYi); encodeB(b, 28 + head_offset, negZi); - encodeA(b_max, 12 + head_offset, (int)(voltage_max[map[PLUS_X]] * 100)); - encodeB(b_max, 13 + head_offset, (int)(voltage_max[map[PLUS_Y]] * 100)); - encodeA(b_max, 15 + head_offset, (int)(voltage_max[map[PLUS_Z]] * 100)); - encodeB(b_max, 16 + head_offset, (int)(voltage_max[map[MINUS_X]] * 100)); - encodeA(b_max, 18 + head_offset, (int)(voltage_max[map[MINUS_Y]] * 100)); - encodeB(b_max, 19 + head_offset, (int)(voltage_max[map[MINUS_Z]] * 100)); - encodeA(b_max, 21 + head_offset, (int)(current_max[map[PLUS_X]] + 0.5) + 2048); - encodeB(b_max, 22 + head_offset, (int)(current_max[map[PLUS_Y]] + 0.5) + 2048); - encodeA(b_max, 24 + head_offset, (int)(current_max[map[PLUS_Z]] + 0.5) + 2048); - encodeB(b_max, 25 + head_offset, (int)(current_max[map[MINUS_X]] + 0.5) + 2048); - encodeA(b_max, 27 + head_offset, (int)(current_max[map[MINUS_Y]] + 0.5) + 2048); - encodeB(b_max, 28 + head_offset, (int)(current_max[map[MINUS_Z]] + 0.5) + 2048); - encodeA(b_max, 9 + head_offset, (int)(current_max[map[BAT]] + 0.5) + 2048); - encodeA(b_max, 3 + head_offset, (int)(voltage_max[map[BAT]] * 100)); - encodeA(b_max, 30 + head_offset, (int)(voltage_max[map[BUS]] * 100)); - encodeB(b_max, 46 + head_offset, (int)(current_max[map[BUS]] + 0.5) + 2048); + encodeA(b_max, 12 + head_offset, (int)(voltage_max[mapping[PLUS_X]] * 100)); + encodeB(b_max, 13 + head_offset, (int)(voltage_max[mapping[PLUS_Y]] * 100)); + encodeA(b_max, 15 + head_offset, (int)(voltage_max[mapping[PLUS_Z]] * 100)); + encodeB(b_max, 16 + head_offset, (int)(voltage_max[mapping[MINUS_X]] * 100)); + encodeA(b_max, 18 + head_offset, (int)(voltage_max[mapping[MINUS_Y]] * 100)); + encodeB(b_max, 19 + head_offset, (int)(voltage_max[mapping[MINUS_Z]] * 100)); + encodeA(b_max, 21 + head_offset, (int)(current_max[mapping[PLUS_X]] + 0.5) + 2048); + encodeB(b_max, 22 + head_offset, (int)(current_max[mapping[PLUS_Y]] + 0.5) + 2048); + encodeA(b_max, 24 + head_offset, (int)(current_max[mapping[PLUS_Z]] + 0.5) + 2048); + encodeB(b_max, 25 + head_offset, (int)(current_max[mapping[MINUS_X]] + 0.5) + 2048); + encodeA(b_max, 27 + head_offset, (int)(current_max[mapping[MINUS_Y]] + 0.5) + 2048); + encodeB(b_max, 28 + head_offset, (int)(current_max[mapping[MINUS_Z]] + 0.5) + 2048); + encodeA(b_max, 9 + head_offset, (int)(current_max[mapping[BAT]] + 0.5) + 2048); + encodeA(b_max, 3 + head_offset, (int)(voltage_max[mapping[BAT]] * 100)); + encodeA(b_max, 30 + head_offset, (int)(voltage_max[mapping[BUS]] * 100)); + encodeB(b_max, 46 + head_offset, (int)(current_max[mapping[BUS]] + 0.5) + 2048); encodeB(b_max, 37 + head_offset, (int)(other_max[RSSI] + 0.5) + 2048); encodeA(b_max, 39 + head_offset, (int)(other_max[IHU_TEMP] * 10 + 0.5)); @@ -356,23 +356,23 @@ void get_tlm_fox() { encodeA(b_max, 48 + head_offset, 2048); encodeB(b_max, 49 + head_offset, 2048); } - encodeA(b_min, 12 + head_offset, (int)(voltage_min[map[PLUS_X]] * 100)); - encodeB(b_min, 13 + head_offset, (int)(voltage_min[map[PLUS_Y]] * 100)); - encodeA(b_min, 15 + head_offset, (int)(voltage_min[map[PLUS_Z]] * 100)); - encodeB(b_min, 16 + head_offset, (int)(voltage_min[map[MINUS_X]] * 100)); - encodeA(b_min, 18 + head_offset, (int)(voltage_min[map[MINUS_Y]] * 100)); - encodeB(b_min, 19 + head_offset, (int)(voltage_min[map[MINUS_Z]] * 100)); - encodeA(b_min, 21 + head_offset, (int)(current_min[map[PLUS_X]] + 0.5) + 2048); - encodeB(b_min, 22 + head_offset, (int)(current_min[map[PLUS_Y]] + 0.5) + 2048); - encodeA(b_min, 24 + head_offset, (int)(current_min[map[PLUS_Z]] + 0.5) + 2048); - encodeB(b_min, 25 + head_offset, (int)(current_min[map[MINUS_X]] + 0.5) + 2048); - encodeA(b_min, 27 + head_offset, (int)(current_min[map[MINUS_Y]] + 0.5) + 2048); - encodeB(b_min, 28 + head_offset, (int)(current_min[map[MINUS_Z]] + 0.5) + 2048); + encodeA(b_min, 12 + head_offset, (int)(voltage_min[mapping[PLUS_X]] * 100)); + encodeB(b_min, 13 + head_offset, (int)(voltage_min[mapping[PLUS_Y]] * 100)); + encodeA(b_min, 15 + head_offset, (int)(voltage_min[mapping[PLUS_Z]] * 100)); + encodeB(b_min, 16 + head_offset, (int)(voltage_min[mapping[MINUS_X]] * 100)); + encodeA(b_min, 18 + head_offset, (int)(voltage_min[mapping[MINUS_Y]] * 100)); + encodeB(b_min, 19 + head_offset, (int)(voltage_min[mapping[MINUS_Z]] * 100)); + encodeA(b_min, 21 + head_offset, (int)(current_min[mapping[PLUS_X]] + 0.5) + 2048); + encodeB(b_min, 22 + head_offset, (int)(current_min[mapping[PLUS_Y]] + 0.5) + 2048); + encodeA(b_min, 24 + head_offset, (int)(current_min[mapping[PLUS_Z]] + 0.5) + 2048); + encodeB(b_min, 25 + head_offset, (int)(current_min[mapping[MINUS_X]] + 0.5) + 2048); + encodeA(b_min, 27 + head_offset, (int)(current_min[mapping[MINUS_Y]] + 0.5) + 2048); + encodeB(b_min, 28 + head_offset, (int)(current_min[mapping[MINUS_Z]] + 0.5) + 2048); - encodeA(b_min, 9 + head_offset, (int)(current_min[map[BAT]] + 0.5) + 2048); - encodeA(b_min, 3 + head_offset, (int)(voltage_min[map[BAT]] * 100)); - encodeA(b_min, 30 + head_offset, (int)(voltage_min[map[BUS]] * 100)); - encodeB(b_min, 46 + head_offset, (int)(current_min[map[BUS]] + 0.5) + 2048); + encodeA(b_min, 9 + head_offset, (int)(current_min[mapping[BAT]] + 0.5) + 2048); + encodeA(b_min, 3 + head_offset, (int)(voltage_min[mapping[BAT]] * 100)); + encodeA(b_min, 30 + head_offset, (int)(voltage_min[mapping[BUS]] * 100)); + encodeB(b_min, 46 + head_offset, (int)(current_min[mapping[BUS]] + 0.5) + 2048); encodeB(b_min, 31 + head_offset, ((int)(other_min[SPIN] * 10)) + 2048); encodeB(b_min, 37 + head_offset, (int)(other_min[RSSI] + 0.5) + 2048);