corecture F_CPU and osccal, there seems to be a bug only when connected to the pc but not to the wall adapter

This commit is contained in:
Jonathan Wyss 2024-03-26 17:35:32 +01:00
parent 6466905783
commit d85647358b
2 changed files with 8 additions and 9 deletions

9
main.c
View File

@ -48,15 +48,14 @@ else msec=0;
int main (void) int main (void)
{ {
int i,i2; int i,i2;
int colorb; //int colorb;
int colora; //int colora;
int sum,avg; int sum,avg;
char sample[64]; char sample[64];
char im[64]; char im[64];
char buff[64]; char buff[64];
char temp;
float fac_r=0.5; float fac_r=0;
float fac_g=0.5; float fac_g=0.5;
float fac_b=1; float fac_b=1;
msec=0; msec=0;
@ -65,7 +64,7 @@ int main (void)
setupADC(); setupADC();
setupTimer(); setupTimer();
OSCCAL = 250;//overclock!!! to 30MHz //OSCCAL = 250;//overclock!!! to 30MHz
for(i=0;i<8;i++) for(i=0;i<8;i++)
{ {
led_bar1[i].r=0; led_bar1[i].r=0;

View File

@ -10,7 +10,7 @@ FORMAT = ihex
TARGET = main TARGET = main
SRC = $(TARGET).c avr_adc.c fix_fft.c light_ws2812_AVR/Light_WS2812/light_ws2812.c SRC = $(TARGET).c avr_adc.c fix_fft.c light_ws2812_AVR/Light_WS2812/light_ws2812.c
ASRC = ASRC =
OPT = 0 OPT = 1
# Name of this Makefile (used for "make depend"). # Name of this Makefile (used for "make depend").
MAKEFILE = Makefile MAKEFILE = Makefile
@ -18,7 +18,7 @@ MAKEFILE = Makefile
# Debugging format. # Debugging format.
# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2. # Native formats for AVR-GCC's -g are stabs [default], or dwarf-2.
# AVR (extended) COFF requires stabs, plus an avr-objcopy run. # AVR (extended) COFF requires stabs, plus an avr-objcopy run.
DEBUG = stabs #DEBUG = stabs
# Compiler flag to set the C Standard level. # Compiler flag to set the C Standard level.
# c89 - "ANSI" C # c89 - "ANSI" C
@ -28,7 +28,7 @@ DEBUG = stabs
CSTANDARD = -std=gnu99 CSTANDARD = -std=gnu99
# Place -D or -U options here # Place -D or -U options here
CDEFS = -D F_CPU=32000000UL CDEFS = -D F_CPU=16000000UL
# Place -I options here # Place -I options here
CINCS = CINCS =
@ -38,7 +38,7 @@ CDEBUG = -g$(DEBUG)
CWARN = -Wall -Wstrict-prototypes CWARN = -Wall -Wstrict-prototypes
CTUNING = -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums CTUNING = -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
#CEXTRA = -Wa,-adhlns=$(<:.c=.lst) #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 #ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs