Skip to content

Commit

Permalink
allow define calibration parametrs for bl09xx (#22030)
Browse files Browse the repository at this point in the history
Co-authored-by: PavelSheremetev <[email protected]>
  • Loading branch information
PavelSheremetev and PavelSheremetev authored Sep 11, 2024
1 parent d8f01ed commit 1edc4b5
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tasmota/tasmota_xnrg_energy/xnrg_14_bl09xx.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1edc4b5

Please sign in to comment.