From 42e3e34ecc59a3a5ef18bebd58d81afca0df9099 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Ple=C3=9F?= Date: Sat, 15 Jun 2013 15:34:47 +0200 Subject: [PATCH] changed overvoltage levels and behaviours --- display/software/powerboard/src/main.c | 14 ++++++++------ display/software/powerboard/src/main.h | 11 +++++++---- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/display/software/powerboard/src/main.c b/display/software/powerboard/src/main.c index 59daa8f..9182608 100644 --- a/display/software/powerboard/src/main.c +++ b/display/software/powerboard/src/main.c @@ -86,7 +86,7 @@ void handle_over_and_undervoltage(void) { if(overvoltage_counter1 OVERVOLTAGE2) { @@ -94,7 +94,7 @@ void handle_over_and_undervoltage(void) { if(overvoltage_counter2= OVERVOLTAGE_TIMEOUT1) { + if(overvoltage_off_counter1 >= OVERVOLTAGEOFF_TIMEOUT1) { overvoltage_counter1 = 0; DUMP_OFF; } @@ -121,17 +121,19 @@ void handle_over_and_undervoltage(void) { GEN_OFF; } - if(overvoltage_off_counter2 >= OVERVOLTAGE_TIMEOUT2) { + if(overvoltage_off_counter2 >= OVERVOLTAGEOFF_TIMEOUT2) { overvoltage_counter2 = 0; GEN_ON; } if(undervoltage_counter >= UNDERVOLTAGE_TIMEOUT) { undervoltage_off_counter = 0; + overvoltage_off_counter1 = OVERVOLTAGEOFF_TIMEOUT1; LOAD_OFF; + DUMP_OFF; } - if(undervoltage_off_counter >= UNDERVOLTAGE_TIMEOUT) { + if(undervoltage_off_counter >= UNDERVOLTAGEOFF_TIMEOUT) { undervoltage_counter = 0; LOAD_ON; } diff --git a/display/software/powerboard/src/main.h b/display/software/powerboard/src/main.h index c1eba92..7834c55 100644 --- a/display/software/powerboard/src/main.h +++ b/display/software/powerboard/src/main.h @@ -24,11 +24,14 @@ #define IS_GEN_ON (PIN_SW & _BV(GENSW)) #define UNDERVOLTAGE 11200 - #define OVERVOLTAGE1 14100 - #define OVERVOLTAGE2 15000 - #define OVERVOLTAGE_TIMEOUT1 5 - #define OVERVOLTAGE_TIMEOUT2 3 + #define OVERVOLTAGE1 15000 + #define OVERVOLTAGE2 16500 + #define OVERVOLTAGE_TIMEOUT1 8 + #define OVERVOLTAGEOFF_TIMEOUT1 1 + #define OVERVOLTAGE_TIMEOUT2 6 + #define OVERVOLTAGEOFF_TIMEOUT2 3 #define UNDERVOLTAGE_TIMEOUT 5 + #define UNDERVOLTAGEOFF_TIMEOUT 2 #define CURRENT_OFFSET 511 #define CURRENT_PER_TICK 72