mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-25 19:56:30 +00:00
Update xsns_02_analog.ino
This commit is contained in:
parent
9af25c73d6
commit
4cf741e6eb
@ -163,7 +163,6 @@ struct {
|
||||
} Adcs;
|
||||
|
||||
struct {
|
||||
// float mq_samples[ANALOG_MQ_SAMPLES];
|
||||
float *mq_samples;
|
||||
float temperature = 0;
|
||||
float current = 0;
|
||||
@ -263,11 +262,10 @@ void AdcAttach(uint32_t pin, uint8_t type) {
|
||||
Adc[Adcs.present].pin = pin;
|
||||
if (adcAttachPin(Adc[Adcs.present].pin)) {
|
||||
if (ADC_MQ == type) {
|
||||
Adc[Adcs.present].mq_samples = (float*)calloc(sizeof(float), ANALOG_MQ_SAMPLES); // Need calloc to reset registers to 0/false
|
||||
Adc[Adcs.present].mq_samples = (float*)calloc(sizeof(float), ANALOG_MQ_SAMPLES); // Need calloc to reset registers to 0
|
||||
if (nullptr == Adc[Adcs.present].mq_samples) { return; }
|
||||
}
|
||||
Adc[Adcs.present].type = type;
|
||||
// analogSetPinAttenuation(Adc[Adcs.present].pin, ADC_11db); // Default
|
||||
Adcs.present++;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user