Skip to content
Snippets Groups Projects
Commit d95ea834 authored by Ondřej Kučera's avatar Ondřej Kučera
Browse files

upgrade battery voltage reading function, update default and maximum delays

parent 7014cc2c
Branches main
No related tags found
No related merge requests found
......@@ -67,8 +67,8 @@ int firebuttonpresed = 0;
bool blinkStatus = true;
bool armed = false;
int firedelay = 2; // delay after pressing "Fire"
float fireduration = 1; // eFuse burn duration
int firedelay = 0; // delay after pressing "Fire"
float fireduration = 2; // eFuse burn duration
CRGB leds[1]; // addressable LED lib
int Lspeed = 1000; // LED blink speed
......@@ -97,14 +97,16 @@ void setup() {
// addressable LED setup
FastLED.addLeds<WS2812B, NEOPIXEL_PIN, GRB>(leds, 1);
FastLED.setBrightness(brightness);
// // refuse to start if there is an eFuse already connected
// // sound the buzzer
// if (digitalRead(CH1_M) | digitalRead(CH2_M)){
// Serial.println("DISCONNECT ALL eFUSES BEFORE POWERING UP!");
// digitalWrite(BUZZER, HIGH);
// while (true);
// }
/*
// refuse to start if there is an eFuse already connected
// sound the buzzer
if (digitalRead(CH1_M) | digitalRead(CH2_M)){
Serial.println("DISCONNECT ALL eFUSES BEFORE POWERING UP!");
digitalWrite(BUZZER, HIGH);
while (true);
}
*/
// start-up beeps
digitalWrite(BUZZER, HIGH);
......@@ -175,7 +177,7 @@ void setup() {
void loop() {
timer.tick();
batterystatus();
voltage = batterystatus();
if (digitalRead(CH1_M)){
ch1_fuse = 1;
......@@ -309,13 +311,12 @@ bool ledBlinkOFF(void *){
}
void batterystatus(){
float ADCmV = analogReadMilliVolts(MBATT); // read ADC
voltage = (ADCmV/1000); // convert to volts
voltage = voltage/3.3*13.3; // calculate battery pack voltage
Serial.println(voltage);
voltage = voltage/3; // calculate cell voltage
Serial.println(voltage);
float batterystatus(){
float _voltage = analogReadMilliVolts(MBATT); // read ADC [milivolts]
_voltage = (_voltage/1000); // convert to volts
_voltage = _voltage/3.3*13.3; // calculate battery pack voltage
_voltage = _voltage/3; // calculate cell voltage
return _voltage;
}
// responses for HTTP GET requests from the web ui
......
......@@ -326,11 +326,11 @@ const char* htmlContent = R"rawliteral(
<h2>Settings</h2>
<label for="delay-slider">Delay:</label>
<input type="range" id="delay-slider" min="0" max="25" value="2">
<input type="range" id="delay-slider" min="0" max="10" value="0">
<span id="delay-value">5s</span>
<label for="duration-slider">Duration:</label>
<input type="range" id="duration-slider" min="0.2" max="2" step="0.2" value="1">
<input type="range" id="duration-slider" min="0.1" max="5" step="0.2" value="2">
<span id="duration-value">10s</span>
<label for="Brightness-slider">LED Brightness</label>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment