Spaces:
Running
Running
File size: 1,578 Bytes
96a5049 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
#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; }
};
|