Skip to content

Commit

Permalink
uart: fix debug code compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
dron0gus committed Jan 6, 2025
1 parent fd1c2f0 commit 5690b5c
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions firmware/uart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,22 @@ static void UartThread(void*)

for (ch = 0; ch < AFR_CHANNELS; ch++) {
float lambda = GetLambda(ch);
const auto& sampler = GetSampler(ch);

int lambdaIntPart = lambda;
int lambdaThousandths = (lambda - lambdaIntPart) * 1000;
int batteryVoltageMv = GetSampler(ch).GetInternalHeaterVoltage() * 1000;
int batteryVoltageMv = sampler.GetInternalHeaterVoltage() * 1000;
int duty = GetHeaterDuty(ch) * 100;

chprintf(chp,
"[AFR%d]: %d.%03d DC: %4d mV AC: %4d mV ESR: %5d T: %4d C Ipump: %6d uA Vheater: %5d heater: %s (%d)\tfault: %s\r\n",
ch,
lambdaIntPart, lambdaThousandths,
(int)(GetSampler(ch).GetNernstDc(ch) * 1000.0),
(int)(GetSampler(ch).GetNernstAc(ch) * 1000.0),
(int)GetSampler(ch).GetSensorInternalResistance(ch),
(int)GetSampler(ch).GetSensorTemperature(ch),
(int)(GetSampler(ch).GetPumpNominalCurrent(ch) * 1000),
(int)(sampler.GetNernstDc() * 1000.0),
(int)(sampler.GetNernstAc() * 1000.0),
(int)sampler.GetSensorInternalResistance(),
(int)sampler.GetSensorTemperature(),
(int)(sampler.GetPumpNominalCurrent() * 1000),
batteryVoltageMv,
describeHeaterState(GetHeaterState(ch)), duty,
describeFault(GetCurrentFault(ch)));
Expand All @@ -59,7 +61,8 @@ static void UartThread(void*)
#if (EGT_CHANNELS > 0)
for (ch = 0; ch < EGT_CHANNELS; ch++) {
chprintf(chp,
"EGT[%d]: %d C (int %d C)\r\n",
"[EGT%d]: %d C (int %d C)\r\n",
ch,
(int)getEgtDrivers()[ch].temperature,
(int)getEgtDrivers()[ch].coldJunctionTemperature);
}
Expand Down

0 comments on commit 5690b5c

Please sign in to comment.