bigcode-starcoder2-15b / engine_control.h
Dikhan1's picture
Upload 24 files
96a5049 verified
raw
history blame
1.58 kB
#pragma once
#include "Arduino.h"
#include "structures.h"
#include "fuel_learning_table.h"
#include "ignition_learning_table.h"
class EngineControl {
private:
float rpm;
float map;
float tps;
float lambda;
float engineTemp;
float voltage;
FuelLearningTable fuelLearning;
IgnitionLearningTable ignitionLearning;
bool learningEnabled;
uint32_t knockEvents;
float currentFuelCorrection;
float currentIgnitionCorrection;
public:
float knockLevel; // Перемещено в public для доступа из основного кода
EngineControl();
void begin();
void update();
// Геттеры
float getRPM() const { return rpm; }
float getMAP() const { return map; }
float getTPS() const { return tps; }
float getLambda() const { return lambda; }
float getEngineTemp() const { return engineTemp; }
float getVoltage() const { return voltage; }
float getLearningProgress() const;
float getIgnitionAdvance();
uint32_t getKnockEvents() const { return knockEvents; }
float getCurrentFuelCorrection() const { return currentFuelCorrection; }
float getCurrentIgnitionCorrection() const { return currentIgnitionCorrection; }
// Управление обучением
void resetLearning() { fuelLearning.reset(); ignitionLearning.reset(); }
bool saveLearningTables();
bool loadLearningTables();
void setLearningEnabled(bool enabled) { learningEnabled = enabled; }
bool isLearningEnabled() const { return learningEnabled; }
};