From d4c1315248fb463da7b13e864b82dddfeb516fc6 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sat, 26 Aug 2023 14:50:33 +0200 Subject: [PATCH] Allow ADE7880 user defines (#19391) --- .../tasmota_xnrg_energy/xnrg_23_ade7880.ino | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tasmota/tasmota_xnrg_energy/xnrg_23_ade7880.ino b/tasmota/tasmota_xnrg_energy/xnrg_23_ade7880.ino index ea6989994..5ffef4222 100644 --- a/tasmota/tasmota_xnrg_energy/xnrg_23_ade7880.ino +++ b/tasmota/tasmota_xnrg_energy/xnrg_23_ade7880.ino @@ -44,20 +44,48 @@ #define ADE7880_WATCHDOG 5 // Allow x seconds of missed interrupts before reinit // Default calibration parameters can be overridden by a rule as documented above. +#ifndef ADE7880_FREQ_INIT #define ADE7880_FREQ_INIT 0 // Connected to networks with fundamental frequencies between 55 Hz and 66 Hz (1). Default 45 Hz to 55 Hz (0). +#endif +#ifndef ADE7880_AIGAIN_INIT #define ADE7880_AIGAIN_INIT 3166385 // rms, current_a +#endif +#ifndef ADE7880_BIGAIN_INIT #define ADE7880_BIGAIN_INIT 3125691 // rms, current_b +#endif +#ifndef ADE7880_CIGAIN_INIT #define ADE7880_CIGAIN_INIT 3131983 // rms, current_c +#endif +#ifndef ADE7880_NIGAIN_INIT #define ADE7880_NIGAIN_INIT 1756557 // rms, current_s !! +#endif +#ifndef ADE7880_AVGAIN_INIT #define ADE7880_AVGAIN_INIT -767262 // rms, voltage_a +#endif +#ifndef ADE7880_BVGAIN_INIT #define ADE7880_BVGAIN_INIT -763439 // rms, voltage_b +#endif +#ifndef ADE7880_CVGAIN_INIT #define ADE7880_CVGAIN_INIT -749854 // rms, voltage_c +#endif +#ifndef ADE7880_APHCAL_INIT #define ADE7880_APHCAL_INIT 180 // angles, angle0 +#endif +#ifndef ADE7880_BPHCAL_INIT #define ADE7880_BPHCAL_INIT 176 // angles, angle1 +#endif +#ifndef ADE7880_CPHCAL_INIT #define ADE7880_CPHCAL_INIT 176 // angles, angle2 +#endif +#ifndef ADE7880_APGAIN_INIT #define ADE7880_APGAIN_INIT -1345820 // powers, totactive, a +#endif +#ifndef ADE7880_BPGAIN_INIT #define ADE7880_BPGAIN_INIT -1347328 // powers, totactive, b +#endif +#ifndef ADE7880_CPGAIN_INIT #define ADE7880_CPGAIN_INIT -1351979 // powers, totactive, c +#endif enum Ade7880DspRegisters { // Register Name Addres R/W Bt CommBln Ty Default Description