wideband/firmware/heater_control.h

32 lines
650 B
C++

#pragma once
#include <cstdint>
#include "can.h"
enum class HeaterState
{
Preheat,
WarmupRamp,
ClosedLoop,
Stopped,
NoHeaterSupply,
};
struct ISampler;
struct IHeaterController
{
virtual void Update(const ISampler& sampler, HeaterAllow heaterAllowState) = 0;
virtual bool IsRunningClosedLoop() const = 0;
virtual float GetHeaterEffectiveVoltage() const = 0;
virtual HeaterState GetHeaterState() const = 0;
};
const IHeaterController& GetHeaterController(int ch);
void StartHeaterControl();
float GetHeaterDuty(int ch);
HeaterState GetHeaterState(int ch);
const char* describeHeaterState(HeaterState state);