From 0b1a157bfd3cd1cdbd3c30469b65d57f5aa7d7bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Ple=C3=9F?= Date: Thu, 13 Jun 2013 00:13:53 +0200 Subject: [PATCH] bugfixes, live check on avr working for now --- display/software/.idea/workspace.xml | 121 +++++++++--------------- display/software/powerboard/Makefile | 2 +- display/software/powerboard/src/main.c | 60 ++++++++++-- display/software/powerboard/src/main.h | 14 +-- display/software/powerboard/src/uart.h | 15 --- display/software/powerboard/src/utils.c | 8 +- display/software/powerboard/src/utils.h | 2 +- 7 files changed, 108 insertions(+), 114 deletions(-) diff --git a/display/software/.idea/workspace.xml b/display/software/.idea/workspace.xml index d107b73..9ea14a9 100644 --- a/display/software/.idea/workspace.xml +++ b/display/software/.idea/workspace.xml @@ -2,13 +2,10 @@ - - - - + @@ -16,8 +13,8 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -142,22 +103,23 @@ - @@ -391,14 +353,18 @@ 1371043815539 1371043815539 - - + - + @@ -413,7 +379,7 @@ - + @@ -464,7 +430,7 @@ @@ -518,22 +485,6 @@ - - - - - - - - - - - - - - - - @@ -548,37 +499,53 @@ - + - + + + + + + + + + + - + - + - + - + - + + + + + + + + - + diff --git a/display/software/powerboard/Makefile b/display/software/powerboard/Makefile index 073f3dd..1e4cbb1 100644 --- a/display/software/powerboard/Makefile +++ b/display/software/powerboard/Makefile @@ -60,7 +60,7 @@ CFLAGS += -Wall -Wstrict-prototypes CFLAGS += -Wa,-adhlns=$(<:.c=.lst) CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) CFLAGS += $(CSTANDARD) -CFLAGS += -DF_CPU=$(F_CPU) -DDEBUG +CFLAGS += -DF_CPU=$(F_CPU) #-DDEBUG diff --git a/display/software/powerboard/src/main.c b/display/software/powerboard/src/main.c index 6d35efa..e933970 100644 --- a/display/software/powerboard/src/main.c +++ b/display/software/powerboard/src/main.c @@ -46,28 +46,28 @@ void measure(void) { } uint8_t get_power(uint16_t voltage, int16_t currents) { - return (voltage * (currents/100)) / 100; + return (voltage/100 * (currents/100)) / 100 ; } -void pretty_print_all_values() { +void pretty_print_all_values(void) { uart_puts_P("Voltage: "); - uart_print_voltage(voltage); - uart_puts_P("V\r\n"); + uart_print_uint16(voltage); + uart_puts_P("mV\r\n"); uart_puts_P("Load: "); - uart_print_current(current_out); + uart_print_int16(current_out); uart_puts_P("mA "); uart_print_uint16( get_power(voltage, current_out)); uart_puts_P("W\r\n"); uart_puts_P("Generator: "); - uart_print_current(current_in); + uart_print_int16(current_in); uart_puts_P("mA "); uart_print_uint16(get_power(voltage, current_in)); uart_puts_P("W\r\n"); } -void handle_over_and_undervoltage() { +void handle_over_and_undervoltage(void) { if(voltage > OVERVOLTAGE1) { overvoltage_off_counter1 = 0; if(overvoltage_counter1