Hi All
The uTasker V1.4 package will be released very shortly so it is time to inform you about a slight change in the string output functions which are not fully compatible with previous versions. It is however possible to use the original versions if desired but it is assumed that most people will want to adapt to suit the new (improved) set, which requires a few adjustments, but nothing difficult.
The new application part of the uTaskerV1.4 demo project uses the define STRING_OPTIMISATION (in types.h) which means that its code is written around the new use. Library type routines adapt themselves depending on whether this is set or not and so can be used with existing projects if the option is not activated.
1) The routine fnDebugDec() has been adapted so that it always send output to the debug interface. To convert to a buffer there is a new function called fnBufferDec(). This is in keeping with the formatted hex output routines.
The following decimal and hex formatted outputs, to debug interface or buffer are thus:
extern CHAR *fnBufferHex(unsigned long ulValue, unsigned char uLen, CHAR *pBuf); // take a value and convert it to a string in a buffer
extern void fnDebugHex(unsigned long ulValue, unsigned char ucLen); // take a value and send it as hex string over the debug interface
extern CHAR *fnBufferDec(signed long slNumberToConvert, unsigned char ucStyle, CHAR *ptrBuf); // take a value and convert it to a string in a buffer
extern void fnDebugDec(signed long slNumberToConvert, unsigned char ucStyle); // take a value and send it as decimal string over the debug interface
Basically it involved removing the third fnDebugDec() parameter in previous projects where it was 0. When it was a buffer, replace fnDebugDec() by fnBufferDec().
2) New formatting parameter WITH_CR_LF
This enables formatted output to be terminated by a carriage return and line feed and can simplify code as follows.
fnDebugMsg("\n\rParameter value = ");
fnDebugHex(ucValue, sizeof(ucValue));
fnDebugMsg("\r\n");
can be simplified to
fnDebugMsg("\n\rParameter value = ");
fnDebugHex(ucValue, (WITH_CR_LF | sizeof(ucValue)));
3) Return pointer changes to fnBufferHex() and uStrcpy().
These routines now return the pointer to the string terminator and not after it, which means that it is easier to concatinate strings. Previously it was necessary to first decrement the returned pointer.
Any code which uses the return value form these routines will need to respect this.
Regards
Mark