Commit 885fd5e3 authored by Peter Zumbruch's avatar Peter Zumbruch
Browse files

fixing output bugs in apfel.c

parent 1626e894
......@@ -25,9 +25,12 @@
#include <avr/iocan128.h>
#endif
static const char const filename[] PROGMEM = __FILE__;
static const char const string_address[] PROGMEM = "port:%c pinSet:%x side:%x chip:%x";
static const char const string_blank[] PROGMEM = " ";
static const char const filename[] PROGMEM = __FILE__;
static const char const string_blank[] PROGMEM = " ";
static const char const string_dac_x_[] PROGMEM = "%s dac:%x ";
static const char const string_address_format[] PROGMEM = "%c %x %x %x";
#define APFEL_ADDRESS_ORDER(port,pinSetIndex, sideSelection, chipId) (port),(pinSetIndex),(sideSelection),(chipId)
bool apfelOscilloscopeTestFrameMode = false;
bool apfelEnableTrigger = false;
......@@ -394,26 +397,20 @@ int16_t apfelReadDac_Inline(apfelAddress *address, uint8_t dacNr, uint8_t quiet)
apfelWriteClockSequence_Inline(address, APFEL_COMMAND_ReadDac_CommandClockCycles_Trailer);
#if 0
if (0 > value)
{
if (!quiet)
CommunicationError_p(ERRA, -1, 1, PSTR("%S %S: readDac failed"), string_address, string_dac_,
address->port, address->pinSetIndex, address->sideSelection, dacNr, address->chipId);
/* Error */
return -1;
}
#endif
// check validity for correct header (10) and trailing bits (111)
/* Error */
if ( APFEL_READ_CHECK_VALUE != (value & APFEL_READ_CHECK_MASK))
{
if (0 == quiet)
{
snprintf_P(resultString, BUFFER_SIZE -1, string_address, address->port, address->pinSetIndex, address->sideSelection, address->chipId );
snprintf_P(resultString, BUFFER_SIZE - 1, PSTR("%s dac:%x"), resultString, dacNr);
CommunicationError(ERRA, -1, 1,
PSTR("%s - read validity check failed, raw value:0x%x"), resultString, value);
clearString(resultString, BUFFER_SIZE);
snprintf_P(resultString, BUFFER_SIZE - 1, string_address_format, APFEL_ADDRESS_ORDER(address->port, address->pinSetIndex, address->sideSelection, address->chipId) );
snprintf_P(resultString, BUFFER_SIZE - 1, string_dac_x_, resultString, dacNr);
CommunicationError(ERRA, -1, 0,
PSTR("%S %S %s- read validity check failed, raw value:0x%x"),
(const char*) ( pgm_read_word( &(commandKeywords[commandKeyNumber_APFEL])) ),
(const char*) ( pgm_read_word( &(apfelApiCommandKeywords[apfelApiCommandKeyNumber_DAC])) ),
resultString, value);
}
return -10;
}
......@@ -425,9 +422,9 @@ int16_t apfelReadDac_Inline(apfelAddress *address, uint8_t dacNr, uint8_t quiet)
createExtendedSubCommandReceiveResponseHeader(ptr_uartStruct, commandKeyNumber_APFEL,
apfelApiCommandKeyNumber_DAC, apfelApiCommandKeywords);
snprintf_P(resultString, BUFFER_SIZE -1, string_address, address->port, address->pinSetIndex, address->sideSelection, address->chipId );
snprintf_P(resultString, BUFFER_SIZE -1, string_address_format, APFEL_ADDRESS_ORDER(address->port, address->pinSetIndex, address->sideSelection, address->chipId) );
strncat(uart_message_string, resultString, BUFFER_SIZE - 1);
snprintf_P(uart_message_string, BUFFER_SIZE - 1, PSTR("%s dac:%x "), uart_message_string, dacNr);
snprintf_P(uart_message_string, BUFFER_SIZE - 1, string_dac_x_, uart_message_string, dacNr);
apiShowValue(uart_message_string, &value, apiVarType_UINT16);
apiSubCommandsFooter(apiCommandResult_SUCCESS_WITH_OUTPUT);
}
......@@ -535,7 +532,7 @@ void apfelListIds_Inline(apfelAddress *address, bool all, uint8_t nElements, uin
{
createExtendedSubCommandReceiveResponseHeader(ptr_uartStruct, commandKeyNumber_APFEL,
apfelApiCommandKeyNumber_LIST, apfelApiCommandKeywords);
snprintf_P(resultString, BUFFER_SIZE -1, string_address, address->port, address->pinSetIndex, address->sideSelection, chipId );
snprintf_P(resultString, BUFFER_SIZE -1, string_address_format, APFEL_ADDRESS_ORDER(address->port, address->pinSetIndex, address->sideSelection, chipId) );
snprintf_P(uart_message_string, BUFFER_SIZE - 1, PSTR("%s%s "), uart_message_string, resultString);
strncat_P(uart_message_string, (result[chipId >> 3] & 1 << (chipId % 8 )) ? PSTR("yes") : PSTR("no"), BUFFER_SIZE - 1);
UART0_Send_Message_String_p(NULL, 0);
......
......@@ -4,4 +4,6 @@ for item in $(echo $fileList)
do
[ -f $item ] && touch $item
echo touching $item
find obj_hadcon_2 -name ${item%%\.*}.o -delete
find obj_hadcon_2 -name ${item%%\.*}.lst -delete
done
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