changed overvoltage levels and behaviours

This commit is contained in:
Lucas Pleß 2013-06-15 15:34:47 +02:00
parent 7b3165aa7c
commit 42e3e34ecc
2 changed files with 15 additions and 10 deletions

View File

@ -86,7 +86,7 @@ void handle_over_and_undervoltage(void) {
if(overvoltage_counter1<OVERVOLTAGE_TIMEOUT1) overvoltage_counter1++;
} else {
overvoltage_counter1 = 0;
if(overvoltage_off_counter1<OVERVOLTAGE_TIMEOUT1) overvoltage_off_counter1++;
if(overvoltage_off_counter1<OVERVOLTAGEOFF_TIMEOUT1) overvoltage_off_counter1++;
}
if(voltage > OVERVOLTAGE2) {
@ -94,7 +94,7 @@ void handle_over_and_undervoltage(void) {
if(overvoltage_counter2<OVERVOLTAGE_TIMEOUT2) overvoltage_counter2++;
} else {
overvoltage_counter2 = 0;
if(overvoltage_off_counter2<OVERVOLTAGE_TIMEOUT2) overvoltage_off_counter2++;
if(overvoltage_off_counter2<OVERVOLTAGEOFF_TIMEOUT2) overvoltage_off_counter2++;
}
if(voltage < UNDERVOLTAGE) {
@ -102,7 +102,7 @@ void handle_over_and_undervoltage(void) {
if(undervoltage_counter<UNDERVOLTAGE_TIMEOUT) undervoltage_counter++;
} else {
undervoltage_counter = 0;
if(undervoltage_off_counter<UNDERVOLTAGE_TIMEOUT) undervoltage_off_counter++;
if(undervoltage_off_counter<UNDERVOLTAGEOFF_TIMEOUT) undervoltage_off_counter++;
}
@ -111,7 +111,7 @@ void handle_over_and_undervoltage(void) {
DUMP_ON;
}
if(overvoltage_off_counter1 >= 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;
}

View File

@ -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