diff --git a/display/software/powerboard/src/main.c b/display/software/powerboard/src/main.c index 351992e..baf5298 100644 --- a/display/software/powerboard/src/main.c +++ b/display/software/powerboard/src/main.c @@ -45,7 +45,7 @@ void measure(void) { current_out *= CURRENT_PER_TICK; } -uint8_t get_power(uint16_t voltage, int16_t currents) { +uint16_t get_power(uint16_t voltage, int16_t currents) { return (voltage/100 * (currents/100)) / 100 ; } diff --git a/display/software/powerboard/src/main.h b/display/software/powerboard/src/main.h index 1a5f3ec..c1eba92 100644 --- a/display/software/powerboard/src/main.h +++ b/display/software/powerboard/src/main.h @@ -10,6 +10,7 @@ #define DUMPSW PB2 #define PORT_SW PORTB #define DDR_SW DDRB + #define PIN_SW PINB #define LOAD_ON PORT_SW |= _BV(LOADSW) #define LOAD_OFF PORT_SW &= ~_BV(LOADSW) @@ -18,7 +19,9 @@ #define DUMP_ON PORT_SW |= _BV(DUMPSW) #define DUMP_OFF PORT_SW &= ~_BV(DUMPSW) - #define IS_LOAD_ON PIND &= _BV(LOADSW); + #define IS_LOAD_ON (PIN_SW & _BV(LOADSW)) + #define IS_DUMP_ON (PIN_SW & _BV(DUMPSW)) + #define IS_GEN_ON (PIN_SW & _BV(GENSW)) #define UNDERVOLTAGE 11200 #define OVERVOLTAGE1 14100