/FollowMe/trunk/main.c |
---|
78,7 → 78,7 |
//BeepTime = 2000; |
Menu_Clear(); |
LCD_Clear(); |
FollowMe_Timer = SetDelay(FOLLOWME_INTERVAL); |
/FollowMe/trunk/makefile |
---|
5,7 → 5,7 |
#------------------------------------------------------------------- |
VERSION_MAJOR = 0 |
VERSION_MINOR = 1 |
VERSION_PATCH = 7 |
VERSION_PATCH = 6 |
VERSION_SERIAL_MAJOR = 11 # Serial Protocol Major Version |
VERSION_SERIAL_MINOR = 0 # Serial Protocol Minor Version |
172,19 → 172,20 |
#AVRDUDE_PROGRAMMER = dt006 |
#AVRDUDE_PROGRAMMER = stk200 |
#AVRDUDE_PROGRAMMER = ponyser |
AVRDUDE_PROGRAMMER = avrispv2 |
AVRDUDE_PROGRAMMER = usbasp |
#falls Ponyser ausgewählt wird, muss sich unsere avrdude-Configdatei im Bin-Verzeichnis des Compilers befinden |
#AVRDUDE_PORT = com1 # programmer connected to serial device |
#AVRDUDE_PORT = lpt1 # programmer connected to parallel port |
AVRDUDE_PORT = usb # programmer connected to USB |
#AVRDUDE_PORT = usb # programmer connected to USB |
#AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex |
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex $(FUSE_SETTINGS) |
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep |
AVRDUDE_WRITE_FUSE = $(FUSE_SETTINGS) |
AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep |
#avrdude -c avrispv2 -P usb -p m32 -U flash:w:blink.hex |
AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) |
AVRDUDE_FLAGS = -p $(MCU) -c $(AVRDUDE_PROGRAMMER) |
# Uncomment the following if you want avrdude's erase cycle counter. |
# Note that this counter needs to be initialized first using -Yn, |
225,8 → 226,7 |
COPY = cp |
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex |
ELFSIZE = $(SIZE) -x -A $(TARGET).elf |
LIMITS = $(SIZE) -C --mcu=$(MCU) $(TARGET).elf |
ELFSIZE = $(SIZE) -A $(TARGET).elf |
# Define Messages |
# English |
282,10 → 282,10 |
# Display size of file. |
sizebefore: |
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); $(HEXSIZE); $(LIMITS); echo; fi |
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi |
sizeafter: |
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); $(HEXSIZE); $(LIMITS); echo; fi |
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi |
318,12 → 318,21 |
# Program the device. |
program: $(TARGET).hex $(TARGET).eep |
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) |
flash: $(TARGET).hex |
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) |
eeprom: $(TARGET).eep |
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_EEPROM) |
fuse: |
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FUSE) |
reset: |
$(AVRDUDE) $(AVRDUDE_FLAGS) |
# Create final output files (.hex, .eep) from ELF output file. |
%.hex: %.elf |
@echo |
/FollowMe/trunk/menu.c |
---|
15,6 → 15,7 |
uint8_t MaxMenuItem = 3; |
uint8_t MenuItem = 0; |
uint8_t RemoteKeys = 0; |
#define KEY1 0x01 |
#define KEY2 0x02 |
32,7 → 33,7 |
/************************************/ |
/* Clear LCD Buffer */ |
/************************************/ |
void Menu_Clear(void) |
void LCD_Clear(void) |
{ |
uint8_t i; |
for( i = 0; i < DISPLAYBUFFSIZE; i++) DisplayBuff[i] = ' '; |
43,23 → 44,23 |
/* Update Menu on LCD */ |
/************************************/ |
// Display with 20 characters in 4 lines |
void Menu_Update(uint8_t Keys) |
void LCD_PrintMenu(void) |
{ |
int16_t i1,i2,i3; |
uint8_t sign; |
if(Keys & KEY1) |
if(RemoteKeys & KEY1) |
{ |
if(MenuItem) MenuItem--; |
else MenuItem = MaxMenuItem; |
} |
if(Keys & KEY2) |
if(RemoteKeys & KEY2) |
{ |
if(MenuItem == MaxMenuItem) MenuItem = 0; |
else MenuItem++; |
} |
/* |
if(Keys & KEY4) |
if(RemoteKeys & KEY4) |
{ |
switch(SysState) |
{ |
76,9 → 77,9 |
break; |
} |
}*/ |
if((Keys & KEY1) && (Keys & KEY2)) MenuItem = 0; |
if((RemoteKeys & KEY1) && (RemoteKeys & KEY2)) MenuItem = 0; |
Menu_Clear(); |
LCD_Clear(); |
if(MenuItem > MaxMenuItem) MenuItem = MaxMenuItem; |
// print menu item number in the upper right corner |
198,4 → 199,5 |
MenuItem = 0; |
break; |
} |
RemoteKeys = 0; |
} |
/FollowMe/trunk/menu.h |
---|
5,12 → 5,13 |
#define DISPLAYBUFFSIZE 80 |
extern void Menu_Update(uint8_t Keys); |
extern void Menu_Clear(void); |
extern void LCD_PrintMenu(void); |
extern void LCD_Clear(void); |
extern int8_t DisplayBuff[DISPLAYBUFFSIZE]; |
extern uint8_t DispPtr; |
extern uint8_t MenuItem; |
extern uint8_t MaxMenuItem; |
extern uint8_t RemoteKeys; |
#endif //_MENU_H |
/FollowMe/trunk/uart0.c |
---|
29,7 → 29,6 |
#define FALSE 0 |
#define TRUE 1 |
#define ABO_TIMEOUT 4000 // disable abo after 4 seconds |
//int8_t test __attribute__ ((section (".noinit"))); |
uint8_t Request_VerInfo = FALSE; |
40,7 → 39,6 |
uint8_t Request_DebugLabel = 255; |
uint8_t Request_SendFollowMe = FALSE; |
uint8_t DisplayLine = 0; |
uint8_t DisplayKeys = 0; |
volatile uint8_t txd_buffer[TXD_BUFFER_LEN]; |
volatile uint8_t rxd_buffer_locked = FALSE; |
51,7 → 49,6 |
volatile uint8_t RxDataLen = 0; |
uint8_t PcAccess = 100; |
uint16_t AboTimeOut = 0; |
ExternControl_t ExternControl; |
DebugOut_t DebugOut; |
60,7 → 57,7 |
uint16_t DebugData_Timer; |
uint16_t DebugData_Interval = 0; // in 1ms |
uint16_t Display_Timer; |
uint16_t Display_Interval = 0; |
uint16_t Display_Interval = 0; // in 1 ms |
Waypoint_t FollowMe; |
438,12 → 435,11 |
} |
else // new format |
{ |
DisplayKeys |= ~pRxData[0]; |
Display_Interval = (uint16_t) pRxData[1] * 10; |
RemoteKeys |= ~pRxData[0]; |
Display_Interval = (unsigned int)pRxData[1] * 10; |
DisplayLine = 4; |
AboTimeOut = SetDelay(ABO_TIMEOUT); |
Request_Display = TRUE; |
} |
Request_Display = TRUE; |
break; |
case 'l':// request for display columns |
459,7 → 455,6 |
case 'd': // request for the debug data |
DebugData_Interval = (uint16_t) pRxData[0] * 10; |
if(DebugData_Interval > 0) Request_DebugData = TRUE; |
AboTimeOut = SetDelay(ABO_TIMEOUT); |
break; |
case 'g':// get external control data |
498,24 → 493,17 |
{ |
if(!txd_complete) return; |
if(CheckDelay(AboTimeOut)) |
{ |
Display_Interval = 0; |
DebugData_Interval = 0; |
} |
if(Request_VerInfo && txd_complete) |
{ |
SendOutData('V', FM_ADDRESS, 1, (uint8_t *) &UART_VersionInfo, sizeof(UART_VersionInfo)); |
Request_VerInfo = FALSE; |
} |
else if( (((Display_Interval > 0) && CheckDelay(Display_Timer)) || Request_Display) && txd_complete) |
if( ((Display_Interval && CheckDelay(Display_Timer)) || Request_Display) && txd_complete) |
{ |
if(DisplayLine > 3)// new format |
{ |
Menu_Update(DisplayKeys); |
DisplayKeys = 0; |
SendOutData('H', FC_ADDRESS, 1, (uint8_t *)DisplayBuff, sizeof(DisplayBuff)); |
LCD_PrintMenu(); |
SendOutData('H', FM_ADDRESS, 1, (uint8_t *)DisplayBuff, 80); |
} |
else // old format |
{ |
526,13 → 514,13 |
Display_Timer = SetDelay(Display_Interval); |
Request_Display = FALSE; |
} |
else if(Request_Display1 && txd_complete) |
if(Request_Display1 && txd_complete) |
{ |
Menu_Update(0); |
SendOutData('L', FC_ADDRESS, 3, &MenuItem, sizeof(MenuItem), &MaxMenuItem, sizeof(MaxMenuItem), DisplayBuff, sizeof(DisplayBuff)); |
LCD_PrintMenu(); |
SendOutData('L', FM_ADDRESS, 3, &MenuItem, sizeof(MenuItem), &MaxMenuItem, sizeof(MaxMenuItem), DisplayBuff, sizeof(DisplayBuff)); |
Request_Display1 = FALSE; |
} |
else if(Request_DebugLabel != 0xFF) // Texte für die Analogdaten |
if(Request_DebugLabel != 0xFF) // Texte für die Analogdaten |
{ |
uint8_t label[16]; // local sram buffer |
memcpy_P(label, ANALOG_LABEL[Request_DebugLabel], 16); // read lable from flash to sram buffer |
539,18 → 527,18 |
SendOutData('A', FM_ADDRESS, 2, (uint8_t *) &Request_DebugLabel, sizeof(Request_DebugLabel), label, 16); |
Request_DebugLabel = 0xFF; |
} |
else if(Request_ExternalControl && txd_complete) |
if(Request_ExternalControl && txd_complete) |
{ |
SendOutData('G', FM_ADDRESS, 1,(uint8_t *) &ExternControl, sizeof(ExternControl)); |
Request_ExternalControl = FALSE; |
} |
else if( (((DebugData_Interval > 0) && CheckDelay(DebugData_Timer)) || Request_DebugData) && txd_complete) |
if( ((DebugData_Interval && CheckDelay(DebugData_Timer)) || Request_DebugData) && txd_complete) |
{ |
SendOutData('D', FM_ADDRESS, 1,(uint8_t *) &DebugOut, sizeof(DebugOut)); |
DebugData_Timer = SetDelay(DebugData_Interval); |
Request_DebugData = FALSE; |
} |
else if(Request_SendFollowMe && txd_complete) |
if(Request_SendFollowMe && txd_complete) |
{ |
SendOutData('s', NC_ADDRESS, 1, (uint8_t *)&FollowMe, sizeof(FollowMe)); |
FollowMe.Position.Status = PROCESSED; |