move ct conversion counter
This commit is contained in:
parent
3a9488d4f8
commit
199a89a700
|
@ -30,7 +30,7 @@ void CurrentTransformerCard::loop()
|
||||||
if (this->lastConversionTime == 0) {
|
if (this->lastConversionTime == 0) {
|
||||||
this->lastConversionTime = millis();
|
this->lastConversionTime = millis();
|
||||||
}
|
}
|
||||||
static uint32_t lastConversionLoopTime = 0;
|
|
||||||
if (millis() - lastConversionLoopTime > this->conversionInterval) {
|
if (millis() - lastConversionLoopTime > this->conversionInterval) {
|
||||||
this->beginConversion();
|
this->beginConversion();
|
||||||
lastConversionLoopTime = millis();
|
lastConversionLoopTime = millis();
|
||||||
|
|
|
@ -46,5 +46,6 @@ class CurrentTransformerCard : public ExpansionCard
|
||||||
std::function<float(uint16_t)> adcToCurrent; // std::function that convert adc value to current in amps
|
std::function<float(uint16_t)> adcToCurrent; // std::function that convert adc value to current in amps
|
||||||
uint8_t handler_count = 0;
|
uint8_t handler_count = 0;
|
||||||
std::map<uint8_t,std::function<void(float, double)>> callbacks;
|
std::map<uint8_t,std::function<void(float, double)>> callbacks;
|
||||||
|
uint32_t lastConversionLoopTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue