After testing some of the features i find that the code for the button timer is not correct when the ntc 10k thermistors are plugged in .
The bms does not shutdown gracefully and this shifts the oled screen upward. Some text for the top appears at the bottom and the text from the middle of the screen is now at the top .
This happens when the user presses the power button for the 3 seconds to shutdown the bms gracefully . However because the Ntc is plugged in the button press requires a delay timer which im not sure how to impliment .
// shutdown BMS if button is pressed > 3 seconds
if (button == 1) {
btnTimer.start();
if (btnTimer.read() > 3) {
BMS.shutdown(); ///// Timer required after this line
}
} else {
btnTimer.stop();
btnTimer.reset();
}
This should prevent the screen from flickering off then on again quickly and shifting text upward.
Please advise the correct way of adding a delay as my skills are limted but delay(10000); doesnt work as its needing a definition. maybe not the correct way ? 10s delay to ignore the button press after being pressed is key to ensuring a quick reboot doesnt occur when shutting down.