From d85647358bf1e692d65af379b9baf85e5d4724a7 Mon Sep 17 00:00:00 2001 From: Jonathan Wyss Date: Tue, 26 Mar 2024 17:35:32 +0100 Subject: [PATCH] corecture F_CPU and osccal, there seems to be a bug only when connected to the pc but not to the wall adapter --- main.c | 9 ++++----- makefile | 8 ++++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/main.c b/main.c index 80fa5c1..5496ceb 100644 --- a/main.c +++ b/main.c @@ -48,15 +48,14 @@ else msec=0; int main (void) { int i,i2; - int colorb; - int colora; + //int colorb; + //int colora; int sum,avg; char sample[64]; char im[64]; char buff[64]; - char temp; - float fac_r=0.5; + float fac_r=0; float fac_g=0.5; float fac_b=1; msec=0; @@ -65,7 +64,7 @@ int main (void) setupADC(); setupTimer(); - OSCCAL = 250;//overclock!!! to 30MHz + //OSCCAL = 250;//overclock!!! to 30MHz for(i=0;i<8;i++) { led_bar1[i].r=0; diff --git a/makefile b/makefile index e91836a..f62ed65 100644 --- a/makefile +++ b/makefile @@ -10,7 +10,7 @@ FORMAT = ihex TARGET = main SRC = $(TARGET).c avr_adc.c fix_fft.c light_ws2812_AVR/Light_WS2812/light_ws2812.c ASRC = -OPT = 0 +OPT = 1 # Name of this Makefile (used for "make depend"). MAKEFILE = Makefile @@ -18,7 +18,7 @@ MAKEFILE = Makefile # Debugging format. # Native formats for AVR-GCC's -g are stabs [default], or dwarf-2. # AVR (extended) COFF requires stabs, plus an avr-objcopy run. -DEBUG = stabs +#DEBUG = stabs # Compiler flag to set the C Standard level. # c89 - "ANSI" C @@ -28,7 +28,7 @@ DEBUG = stabs CSTANDARD = -std=gnu99 # Place -D or -U options here -CDEFS = -D F_CPU=32000000UL +CDEFS = -D F_CPU=16000000UL # Place -I options here CINCS = @@ -38,7 +38,7 @@ CDEBUG = -g$(DEBUG) CWARN = -Wall -Wstrict-prototypes CTUNING = -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums #CEXTRA = -Wa,-adhlns=$(<:.c=.lst) -CFLAGS = $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CSTANDARD) $(CEXTRA) +CFLAGS = $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CSTANDARD)# $(CEXTRA) #ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs