Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 759 → Rev 765

/FollowMe/trunk/main.c
78,7 → 78,7
 
//BeepTime = 2000;
 
LCD_Clear();
Menu_Clear();
 
FollowMe_Timer = SetDelay(FOLLOWME_INTERVAL);
 
/FollowMe/trunk/makefile
5,7 → 5,7
#-------------------------------------------------------------------
VERSION_MAJOR = 0
VERSION_MINOR = 1
VERSION_PATCH = 6
VERSION_PATCH = 7
 
VERSION_SERIAL_MAJOR = 11 # Serial Protocol Major Version
VERSION_SERIAL_MINOR = 0 # Serial Protocol Minor Version
172,20 → 172,19
#AVRDUDE_PROGRAMMER = dt006
#AVRDUDE_PROGRAMMER = stk200
#AVRDUDE_PROGRAMMER = ponyser
AVRDUDE_PROGRAMMER = usbasp
AVRDUDE_PROGRAMMER = avrispv2
#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_FUSE = $(FUSE_SETTINGS)
AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
 
#avrdude -c avrispv2 -P usb -p m32 -U flash:w:blink.hex
AVRDUDE_FLAGS = -p $(MCU) -c $(AVRDUDE_PROGRAMMER)
AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -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,
226,7 → 225,8
COPY = cp
 
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
ELFSIZE = $(SIZE) -A $(TARGET).elf
ELFSIZE = $(SIZE) -x -A $(TARGET).elf
LIMITS = $(SIZE) -C --mcu=$(MCU) $(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); echo; fi
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); $(HEXSIZE); $(LIMITS); echo; fi
 
sizeafter:
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); $(HEXSIZE); $(LIMITS); echo; fi
 
 
 
318,21 → 318,12
 
 
# Program the device.
flash: $(TARGET).hex
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH)
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
 
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,7 → 15,6
 
uint8_t MaxMenuItem = 3;
uint8_t MenuItem = 0;
uint8_t RemoteKeys = 0;
 
#define KEY1 0x01
#define KEY2 0x02
33,7 → 32,7
/************************************/
/* Clear LCD Buffer */
/************************************/
void LCD_Clear(void)
void Menu_Clear(void)
{
uint8_t i;
for( i = 0; i < DISPLAYBUFFSIZE; i++) DisplayBuff[i] = ' ';
44,23 → 43,23
/* Update Menu on LCD */
/************************************/
// Display with 20 characters in 4 lines
void LCD_PrintMenu(void)
void Menu_Update(uint8_t Keys)
{
int16_t i1,i2,i3;
uint8_t sign;
 
if(RemoteKeys & KEY1)
if(Keys & KEY1)
{
if(MenuItem) MenuItem--;
else MenuItem = MaxMenuItem;
}
if(RemoteKeys & KEY2)
if(Keys & KEY2)
{
if(MenuItem == MaxMenuItem) MenuItem = 0;
else MenuItem++;
}
/*
if(RemoteKeys & KEY4)
if(Keys & KEY4)
{
switch(SysState)
{
77,9 → 76,9
break;
}
}*/
if((RemoteKeys & KEY1) && (RemoteKeys & KEY2)) MenuItem = 0;
if((Keys & KEY1) && (Keys & KEY2)) MenuItem = 0;
 
LCD_Clear();
Menu_Clear();
 
if(MenuItem > MaxMenuItem) MenuItem = MaxMenuItem;
// print menu item number in the upper right corner
199,5 → 198,4
MenuItem = 0;
break;
}
RemoteKeys = 0;
}
/FollowMe/trunk/menu.h
5,13 → 5,12
 
#define DISPLAYBUFFSIZE 80
 
extern void LCD_PrintMenu(void);
extern void LCD_Clear(void);
extern void Menu_Update(uint8_t Keys);
extern void Menu_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,6 → 29,7
#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;
39,6 → 40,7
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;
49,6 → 51,7
volatile uint8_t RxDataLen = 0;
 
uint8_t PcAccess = 100;
uint16_t AboTimeOut = 0;
 
ExternControl_t ExternControl;
DebugOut_t DebugOut;
57,7 → 60,7
uint16_t DebugData_Timer;
uint16_t DebugData_Interval = 0; // in 1ms
uint16_t Display_Timer;
uint16_t Display_Interval = 0; // in 1 ms
uint16_t Display_Interval = 0;
 
Waypoint_t FollowMe;
 
428,7 → 431,7
 
case 'h':// request for display columns
PcAccess = 255;
if((pRxData[0] & 0x80) == 0x00) // old format
if((pRxData[0] & 0x80) == 0x00) // old format
{
DisplayLine = 2;
Display_Interval = 0;
435,11 → 438,12
}
else // new format
{
RemoteKeys |= ~pRxData[0];
Display_Interval = (unsigned int)pRxData[1] * 10;
DisplayKeys |= ~pRxData[0];
Display_Interval = (uint16_t) pRxData[1] * 10;
DisplayLine = 4;
Request_Display = TRUE;
AboTimeOut = SetDelay(ABO_TIMEOUT);
}
Request_Display = TRUE;
break;
 
case 'l':// request for display columns
446,7 → 450,7
PcAccess = 255;
MenuItem = pRxData[0];
Request_Display1 = TRUE;
break;
break;
 
case 'v': // request for version and board release
Request_VerInfo = TRUE;
455,7 → 459,8
case 'd': // request for the debug data
DebugData_Interval = (uint16_t) pRxData[0] * 10;
if(DebugData_Interval > 0) Request_DebugData = TRUE;
break;
AboTimeOut = SetDelay(ABO_TIMEOUT);
break;
 
case 'g':// get external control data
Request_ExternalControl = TRUE;
493,17 → 498,24
{
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;
}
if( ((Display_Interval && CheckDelay(Display_Timer)) || Request_Display) && txd_complete)
else if( (((Display_Interval > 0) && CheckDelay(Display_Timer)) || Request_Display) && txd_complete)
{
if(DisplayLine > 3)// new format
{
LCD_PrintMenu();
SendOutData('H', FM_ADDRESS, 1, (uint8_t *)DisplayBuff, 80);
Menu_Update(DisplayKeys);
DisplayKeys = 0;
SendOutData('H', FC_ADDRESS, 1, (uint8_t *)DisplayBuff, sizeof(DisplayBuff));
}
else // old format
{
514,13 → 526,13
Display_Timer = SetDelay(Display_Interval);
Request_Display = FALSE;
}
if(Request_Display1 && txd_complete)
else if(Request_Display1 && txd_complete)
{
LCD_PrintMenu();
SendOutData('L', FM_ADDRESS, 3, &MenuItem, sizeof(MenuItem), &MaxMenuItem, sizeof(MaxMenuItem), DisplayBuff, sizeof(DisplayBuff));
Menu_Update(0);
SendOutData('L', FC_ADDRESS, 3, &MenuItem, sizeof(MenuItem), &MaxMenuItem, sizeof(MaxMenuItem), DisplayBuff, sizeof(DisplayBuff));
Request_Display1 = FALSE;
}
if(Request_DebugLabel != 0xFF) // Texte für die Analogdaten
else 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
527,18 → 539,18
SendOutData('A', FM_ADDRESS, 2, (uint8_t *) &Request_DebugLabel, sizeof(Request_DebugLabel), label, 16);
Request_DebugLabel = 0xFF;
}
if(Request_ExternalControl && txd_complete)
else if(Request_ExternalControl && txd_complete)
{
SendOutData('G', FM_ADDRESS, 1,(uint8_t *) &ExternControl, sizeof(ExternControl));
Request_ExternalControl = FALSE;
}
if( ((DebugData_Interval && CheckDelay(DebugData_Timer)) || Request_DebugData) && txd_complete)
else if( (((DebugData_Interval > 0) && 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;
}
if(Request_SendFollowMe && txd_complete)
else if(Request_SendFollowMe && txd_complete)
{
SendOutData('s', NC_ADDRESS, 1, (uint8_t *)&FollowMe, sizeof(FollowMe));
FollowMe.Position.Status = PROCESSED;