Commit 2459434a authored by Peter Zumbruch's avatar Peter Zumbruch
Browse files

merged in 4.6.2

parent 4207b882
......@@ -9,3 +9,5 @@ obj_hadcon_*/
*.hex
/echo
/HADCON_VERSION=1 TARGET=api_hadcon1 make -f Makefile_HadconX program
/HADCON_make.log
/HADCON_VERSION=2 TARGET=api_hadcon2 make -f Makefile_HadconX program
......@@ -721,8 +721,28 @@ void Process_Uart_Event(void)
/* clear uartString, avoiding memset*/
clearString(uartString, BUFFER_SIZE);
printDebug_p(debugLevelEventDebug, debugSystemUART, __LINE__, filename, PSTR("UART string received:%s"), decrypt_uartString);
printDebug_p(debugLevelEventDebug, debugSystemUART, __LINE__, filename, PSTR("UART string received:'%s'"), decrypt_uartString);
if (globalDebugLevel >= debugLevelEventDebugVerbose)
{
clearString(message, BUFFER_SIZE);
char uartCurrentCharacter;
size_t index=0;
while( decrypt_uartString[index] )
{
uartCurrentCharacter = decrypt_uartString[index];
if (!iscntrl(uartCurrentCharacter))
{
snprintf_P(message, BUFFER_SIZE -1, PSTR("%s%c"), message, uartCurrentCharacter);
}
else
{
snprintf_P(message, BUFFER_SIZE -1, PSTR("%s^[%#o"), message, uartCurrentCharacter);
}
index++;
}
printDebug_p(debugLevelEventDebugVerbose, debugSystemUART, __LINE__, filename, PSTR("UART string received:'%s'"), decrypt_uartString);
}
/* split uart string into its elements */
......@@ -1088,16 +1108,25 @@ int8_t apiFindCommandKeywordIndex(const char string[], PGM_P keywords[], size_t
// find matching command keyword
size_t keywordIndex = 0;
while ( keywordIndex < keywordMaximumIndex )
/*first find max non control length*/
size_t length = 0;
for (length = 0; length < strlen(string) && length < MAX_LENGTH_PARAMETER; length++)
{
if (iscntrl(string[length])) break;
}
printDebug_p(debugLevelEventDebug, debugSystemCommandKey, __LINE__, filename, PSTR("keyword length: %i, strlen: %i "), length, strlen(string));
while ( keywordIndex < keywordMaximumIndex )
{
if ( 0 == strncasecmp_P(string, (const char*) ( pgm_read_word( &(keywords[keywordIndex])) ), MAX_LENGTH_PARAMETER) )
if ( 0 == strncasecmp_P(string, (const char*) ( pgm_read_word( &(keywords[keywordIndex])) ), length) )
{
printDebug_p(debugLevelEventDebug, debugSystemCommandKey, __LINE__, filename, PSTR("keyword %s matches, index %i "), string, keywordIndex);
printDebug_p(debugLevelEventDebug, debugSystemCommandKey, __LINE__, filename, PSTR("keyword '%s' matches, index %i "), string, keywordIndex);
return keywordIndex;
}
else
{
printDebug_p(debugLevelEventDebugVerbose, debugSystemCommandKey, __LINE__, filename, PSTR("keyword %s doesn't match"), string);
printDebug_p(debugLevelEventDebugVerbose, debugSystemCommandKey, __LINE__, filename, PSTR("keyword '%s' doesn't match '%S'"), string, (const char*) ( pgm_read_word( &(keywords[keywordIndex])) ));
keywordIndex++;
}
}
......@@ -1467,10 +1496,10 @@ ISR (SIG_UART0_RECV)
{
unsigned char c = UDR0;
if ( c == '\n' ) /* the string is complete? */
if ( c == '\n' || c == '\r' ) /* the string is complete? */
{
uartString[nextCharPos] = '\0';
uartReady = 1; /* mark, that we got an CAN_interrupt, to be handled by main */
uartReady = 1; /* mark, that we got an UART_interrupt, to be handled by main */
nextCharPos = 0;
}
else if ( BUFFER_SIZE - 1 == nextCharPos ) /* string exceeds length, skip remainder, set flag */
......
......@@ -2,7 +2,7 @@
#define API_DEFINE__H
/*the define.h header file contents all define variable*/
#define CODE_VERSION "4.6.1"
#define CODE_VERSION "4.6.2"
#ifndef HADCON_VERSION
#define HADCON_VERSION 2
......
......@@ -1589,7 +1589,7 @@ ISR(OVRIT_vect)
* canBusStoredState to undefined
* to allow for recovery */
printDebug_p(debugLevelEventDebugVerbose, debugSystemCAN, __LINE__, filename,
printDebug_p(debugLevelPeriodicDebug, debugSystemCAN, __LINE__, filename,
PSTR("bus state %S"), (const char*) (pgm_read_word( &(canBusModes[canBusStoredState]))));
switch (canBusStoredState)
......@@ -1601,7 +1601,7 @@ ISR(OVRIT_vect)
break;
default:
canPeriodicCanTimerCanBusStateReset();
printDebug_p(debugLevelEventDebug, debugSystemCAN, __LINE__, filename, PSTR("bus state %S"),
printDebug_p(debugLevelPeriodicDebug, debugSystemCAN, __LINE__, filename, PSTR("bus state %S"),
(const char*) (pgm_read_word( &(canBusModes[canBusStoredState]))));
break;
}
......
......@@ -111,12 +111,12 @@ uint8_t usercommand;
char* ptr_setParameter[MAX_PARAMETER];
volatile unsigned char timer0Ready;/*variable for Timer0 Interrupt*/
volatile unsigned char timer1Ready;/*variable for Timer1 Interrupt*/
volatile unsigned char timer0AReady;/*variable for Timer0 Output Compare A Interrupt*/
volatile unsigned char timer0ASchedulerReady;/*variable for Timer0 Output Compare A Interrupt*/
volatile unsigned char timer0Ready = 0;/*variable for Timer0 Interrupt*/
volatile unsigned char timer1Ready = 0;/*variable for Timer1 Interrupt*/
volatile unsigned char timer0AReady = 0;/*variable for Timer0 Output Compare A Interrupt*/
volatile unsigned char timer0ASchedulerReady = 0;/*variable for Timer0 Output Compare A Interrupt*/
volatile unsigned char canReady; /*variable for can interrupt*/
volatile unsigned char canReady = 0; /*variable for can interrupt*/
volatile unsigned char canTimerOverrun; /*variable for can timer overrun interrupt*/
volatile unsigned char canCurrentGeneralStatus;/*variable for can interrupt*/
volatile unsigned char canCurrentGeneralInterruptRegister;/*variable for can interrupt*/
......@@ -126,7 +126,7 @@ volatile unsigned char canCurrentReceiveErrorCounter;/*variable for can error ha
char canStoreString[MAX_LENGTH_CAN_DATA];
volatile unsigned char uartReady;/*variable for Uart interrupt*/
volatile unsigned char uartReady = 0;/*variable for Uart interrupt*/
char uartString[BUFFER_SIZE]; /* variable for storage received a complete string via UART */
char decrypt_uartString[BUFFER_SIZE];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment