diff --git a/tasmota/tasmota_xnrg_energy/xnrg_14_bl09xx.ino b/tasmota/tasmota_xnrg_energy/xnrg_14_bl09xx.ino index 3c49d0913..4d9d1b15f 100644 --- a/tasmota/tasmota_xnrg_energy/xnrg_14_bl09xx.ino +++ b/tasmota/tasmota_xnrg_energy/xnrg_14_bl09xx.ino @@ -44,26 +44,48 @@ //#define DEBUG_BL09XX +#ifndef BL0939_PREF #define BL0939_PREF 713 // =(4046*1*0,51*1000)/(1,218*1,218*(390*5+0,51)) = 713,105 +#endif +#ifndef BL0939_UREF #define BL0939_UREF 17159 // =(79931*0,51*1000)/(1,218*(390*5+0,51)) = 17158,92 +#endif +#ifndef BL0939_IREF #define BL0939_IREF 266013 // =(324004*1)/1,218 = 266013,14 +#endif +#ifndef BL0940_PREF #define BL0940_PREF 1430 +#endif +#ifndef BL0940_UREF #define BL0940_UREF 33000 +#endif +#ifndef BL0940_IREF #define BL0940_IREF 275000 +#endif +#ifndef BL0942_PREF #define BL0942_PREF 596 +#endif +#ifndef BL0942_UREF #define BL0942_UREF 15187 +#endif +#ifndef BL0942_IREF #define BL0942_IREF 251213 +#endif +#ifndef BL09XX_WRITE_COMMAND #define BL09XX_WRITE_COMMAND 0xA0 // 0xA8 according to documentation +#endif #define BL09XX_REG_I_FAST_RMS_CTRL 0x10 #define BL09XX_REG_MODE 0x18 #define BL09XX_REG_SOFT_RESET 0x19 #define BL09XX_REG_USR_WRPROT 0x1A #define BL09XX_REG_TPS_CTRL 0x1B +#ifndef BL09XX_READ_COMMAND #define BL09XX_READ_COMMAND 0x50 // 0x58 according to documentation +#endif #define BL09XX_FULL_PACKET 0xAA #define BL09XX_PACKET_HEADER 0x55 // 0x58 according to documentation