You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've called the function every way possible but I can't seem to turn off either FET.
bms.set_0xE1_mosfet_control(false,false); // My understanding is that this call should disable both FETs, but it doesn't
bms.set_0xE1_mosfet_control(false, true); // My understanding is that this call should disable the charge FET, but it doesn't
bms.set_0xE1_mosfet_control(true, false); // My understanding is that this call should disable the discharge FET, but it doesn't
bms.set_0xE1_mosfet_control(true, true); // My understanding is that this call should enable both FETs, but since I was never able to disable the FETs, I don't know if this actually turns them on
The text was updated successfully, but these errors were encountered:
I edited bms2.cpp in each of these functions to write m_0xE1_mosfet_control[1] and not m_0xE1_mosfet_control[0] and now I can control the charge FET and the discharge FET. Here is the new code that seems to work correctly. As always, use at your own risk.
// ###########################################################################
// 0xE1 Set MOSFET
// ###########################################################################
// bit 0: Set to disable charge FET
// bit 1: Set to disable discharge FET
void OverkillSolarBms2::set_0xE1_mosfet_control(bool charge, bool discharge) {
#ifdef BMS_OPTION_DEBUG
// Serial.println("Set 0xE1 MOSFET Control");
#endif
if (charge) {
m_0xE1_mosfet_control[1] &= 0b10; // Disable bit zero
}
else {
m_0xE1_mosfet_control[1] |= 0b01; // Enable bit zero
}
if (discharge) {
m_0xE1_mosfet_control[1] &= 0b01; // Disable bit 1
}
else {
m_0xE1_mosfet_control[1] |= 0b10; // Enable bit 1
}
write(BMS_WRITE, BMS_REG_CTL_MOSFET, m_0xE1_mosfet_control, 2);
}
void OverkillSolarBms2::set_0xE1_mosfet_control_charge(bool charge) {
if (charge) {
m_0xE1_mosfet_control[1] &= 0b10; // Disable bit zero
}
else {
m_0xE1_mosfet_control[1] |= 0b01; // Enable bit zero
}
write(BMS_WRITE, BMS_REG_CTL_MOSFET, m_0xE1_mosfet_control, 2);
}
void OverkillSolarBms2::set_0xE1_mosfet_control_discharge(bool discharge) {
if (discharge) {
m_0xE1_mosfet_control[1] &= 0b01; // Disable bit 1
}
else {
m_0xE1_mosfet_control[1] |= 0b10; // Enable bit 1
}
write(BMS_WRITE, BMS_REG_CTL_MOSFET, m_0xE1_mosfet_control, 2);
}
I've called the function every way possible but I can't seem to turn off either FET.
bms.set_0xE1_mosfet_control(false,false); // My understanding is that this call should disable both FETs, but it doesn't
bms.set_0xE1_mosfet_control(false, true); // My understanding is that this call should disable the charge FET, but it doesn't
bms.set_0xE1_mosfet_control(true, false); // My understanding is that this call should disable the discharge FET, but it doesn't
bms.set_0xE1_mosfet_control(true, true); // My understanding is that this call should enable both FETs, but since I was never able to disable the FETs, I don't know if this actually turns them on
The text was updated successfully, but these errors were encountered: