diff --git a/EBB_firmware/app.X/source/UBW.c b/EBB_firmware/app.X/source/UBW.c index 75b3647..d53512d 100644 --- a/EBB_firmware/app.X/source/UBW.c +++ b/EBB_firmware/app.X/source/UBW.c @@ -154,7 +154,7 @@ volatile unsigned int ChannelBit; #elif defined(BOARD_EBB_V12) const rom char st_version[] = {"EBBv12 EB Firmware Version 2.2.1"}; #elif defined(BOARD_EBB_V13_AND_ABOVE) - const rom char st_version[] = {"EBBv13_and_above EB Firmware Version 2.9.05"}; + const rom char st_version[] = {"EBBv13_and_above EB Firmware Version 2.9.06"}; #elif defined(BOARD_UBW) const rom char st_version[] = {"UBW EB Firmware Version 2.2.1"}; #endif @@ -1184,7 +1184,7 @@ void parse_packet(void) command = gCommand_Char1; // Only grab second one if it is not a comma - if (g_RX_buf[g_RX_buf_out] != (BYTE)',' && g_RX_buf[g_RX_buf_out] != kCR) + if (g_RX_buf[g_RX_buf_out] != (BYTE)',' && g_RX_buf[g_RX_buf_out] != kCR && g_RX_buf[g_RX_buf_out] != kLF) { gCommand_Char2 = toupper(g_RX_buf[g_RX_buf_out]); advance_RX_buf_out(); @@ -1631,9 +1631,9 @@ void parse_packet(void) // to the EBB, it will respond with the two character command code (at least, // some commands will return more than that). // If Legacy line ending mode is turned on this function will not print anything -void print_command(BOOL print_comma) +void print_command(BOOL print_always, BOOL print_comma) { - if (bittstzero(gStandardizedCommandFormat)) + if (bittstzero(gStandardizedCommandFormat) || print_always) { _user_putc(gCommand_Char1); if (gCommand_Char2 != 0u) @@ -1687,7 +1687,7 @@ void print_line_ending(tLineEnding le_type) // Return all I/Os to their default power-on values void parse_R_packet(void) { - print_command(FALSE); + print_command(FALSE, FALSE); print_line_ending(kLE_OK_NORM); UserInit(); } @@ -1713,7 +1713,7 @@ void parse_CU_packet(void) UINT8 parameter_number; INT16 paramater_value; - print_command(FALSE); + print_command(FALSE, FALSE); extract_number(kUCHAR, ¶meter_number, kREQUIRED); extract_number(kINT, ¶mater_value, kREQUIRED); @@ -1976,7 +1976,7 @@ void parse_QU_packet(void) { UINT8 parameter_number; - print_command(TRUE); + print_command(FALSE, TRUE); extract_number(kUCHAR, ¶meter_number, kREQUIRED); @@ -2014,7 +2014,7 @@ void parse_T_packet(void) unsigned int value; unsigned char mode = 0; - print_command(FALSE); + print_command(FALSE, FALSE); // Extract the value extract_number(kUINT, (void *)&time_between_updates, kREQUIRED); @@ -2077,7 +2077,7 @@ void parse_C_packet(void) { unsigned char PA, PB, PC, PD, PE; - print_command(FALSE); + print_command(FALSE, FALSE); // Extract each of the four values. extract_number(kUCHAR, &PA, kREQUIRED); @@ -2169,7 +2169,7 @@ void parse_AC_packet(void) { unsigned char Channel, Enable; - print_command(FALSE); + print_command(FALSE, FALSE); // Extract each of the two values. extract_number(kUCHAR, &Channel, kREQUIRED); @@ -2193,7 +2193,7 @@ void parse_O_packet(void) unsigned char Value; ExtractReturnType RetVal; - print_command(FALSE); + print_command(FALSE, FALSE); // Extract each of the values. RetVal = extract_number(kUCHAR, &Value, kREQUIRED); @@ -2270,7 +2270,7 @@ void parse_O_packet(void) // The rest will be read in as zeros. void parse_I_packet(void) { - print_command(TRUE); + print_command(FALSE, TRUE); #if defined(BOARD_EBB_V10) printf( @@ -2310,7 +2310,7 @@ void parse_I_packet(void) // All we do here is just print out our version number void parse_V_packet(void) { - print_command(TRUE); + print_command(FALSE, TRUE); printf((far rom char *)st_version); print_line_ending(kLE_NORM); @@ -2327,7 +2327,7 @@ void parse_A_packet(void) char channel = 0; unsigned int ChannelBit = 0x0001; - print_command(FALSE); + print_command(TRUE, FALSE); // Sit and spin, waiting for one set of analog conversions to complete while (PIE1bits.ADIE); @@ -2361,7 +2361,7 @@ void parse_MW_packet(void) unsigned int location; unsigned char value; - print_command(FALSE); + print_command(FALSE, FALSE); extract_number(kUINT, &location, kREQUIRED); extract_number(kUCHAR, &value, kREQUIRED); @@ -2391,7 +2391,7 @@ void parse_MR_packet(void) unsigned int location; unsigned char value; - print_command(TRUE); + print_command(FALSE, TRUE); extract_number(kUINT, &location, kREQUIRED); @@ -2426,7 +2426,7 @@ void parse_PD_packet(void) unsigned char pin; unsigned char direction; - print_command(FALSE); + print_command(FALSE, FALSE); extract_number(kUCASE_ASCII_CHAR, &port, kREQUIRED); extract_number(kUCHAR, &pin, kREQUIRED); @@ -2574,7 +2574,7 @@ void parse_PI_packet(void) unsigned char pin; unsigned char value = 0; - print_command(TRUE); + print_command(FALSE, TRUE); extract_number(kUCASE_ASCII_CHAR, &port, kREQUIRED); extract_number(kUCHAR, &pin, kREQUIRED); @@ -2664,7 +2664,7 @@ void parse_PO_packet(void) unsigned char pin; unsigned char value; - print_command(FALSE); + print_command(FALSE, FALSE); extract_number(kUCASE_ASCII_CHAR, &port, kREQUIRED); extract_number(kUCHAR, &pin, kREQUIRED); @@ -2812,7 +2812,7 @@ void parse_PO_packet(void) // software TX buffer. void parse_TX_packet(void) { - print_command(FALSE); + print_command(FALSE, FALSE); print_line_ending(kLE_OK_NORM); } @@ -2846,7 +2846,7 @@ void parse_TX_packet(void) // data to the UBW and you have the serial port set to a low baud rate. void parse_RX_packet(void) { - print_command(FALSE); + print_command(FALSE, FALSE); print_line_ending(kLE_OK_NORM); } @@ -2854,7 +2854,7 @@ void parse_RX_packet(void) // TBD void parse_CX_packet(void) { - print_command(FALSE); + print_command(FALSE, FALSE); print_line_ending(kLE_OK_NORM); } @@ -2878,7 +2878,7 @@ void parse_RC_packet(void) unsigned char pin; unsigned int value; - print_command(FALSE); + print_command(FALSE, FALSE); extract_number(kUCASE_ASCII_CHAR, &port, kREQUIRED); extract_number(kUCHAR, &pin, kREQUIRED); @@ -2972,7 +2972,7 @@ void parse_BC_packet(void) // // And initialize Port A // LATA = g_BO_init; // - print_command(FALSE); + print_command(FALSE, FALSE); print_line_ending(kLE_OK_NORM); } @@ -3107,7 +3107,7 @@ void parse_BO_packet(void) // } // } // } - print_command(FALSE); + print_command(FALSE, FALSE); print_line_ending(kLE_OK_NORM); } @@ -3225,42 +3225,42 @@ void parse_BS_packet(void) // } // } // } - print_command(FALSE); + print_command(FALSE, FALSE); print_line_ending(kLE_OK_NORM); } // SS Send SPI void parse_SS_packet(void) { - print_command(FALSE); + print_command(FALSE, FALSE); print_line_ending(kLE_OK_NORM); } // RS Receive SPI void parse_RS_packet(void) { - print_command(FALSE); + print_command(FALSE, FALSE); print_line_ending(kLE_OK_NORM); } // SI Send I2C void parse_SI_packet(void) { - print_command(FALSE); + print_command(FALSE, FALSE); print_line_ending(kLE_OK_NORM); } // RI Receive I2C void parse_RI_packet(void) { - print_command(FALSE); + print_command(FALSE, FALSE); print_line_ending(kLE_OK_NORM); } // CI Configure I2C void parse_CI_packet(void) { - print_command(FALSE); + print_command(FALSE, FALSE); print_line_ending(kLE_OK_NORM); } @@ -3279,7 +3279,7 @@ void parse_PC_packet(void) unsigned char i; ExtractReturnType RetVal1, RetVal2; - print_command(FALSE); + print_command(FALSE, FALSE); extract_number(kUINT, &Length, kREQUIRED); extract_number(kUINT, &Rate, kREQUIRED); @@ -3326,7 +3326,7 @@ void parse_PG_packet(void) { unsigned char Value; - print_command(FALSE); + print_command(FALSE, FALSE); extract_number(kUCHAR, &Value, kREQUIRED); @@ -3413,7 +3413,7 @@ void parse_RB_packet(void) // 1 = power to RC servo on void parse_QR_packet(void) { - print_command(TRUE); + print_command(FALSE, TRUE); printf((far rom char *)"%1u", RCServoPowerIO_PORT); print_line_ending(kLE_OK_NORM); @@ -3436,7 +3436,7 @@ void parse_SR_packet(void) UINT8 State; ExtractReturnType GotState; - print_command(FALSE); + print_command(FALSE, FALSE); extract_number(kULONG, &Value, kREQUIRED); GotState = extract_number(kUCHAR, &State, kOPTIONAL); @@ -3478,7 +3478,7 @@ void parse_CK_packet(void) unsigned char UChar; unsigned char UCaseChar; - print_command(FALSE); + print_command(FALSE, FALSE); print_line_ending(kLE_NORM); extract_number(kCHAR, &SByte, kREQUIRED); @@ -3569,7 +3569,7 @@ void parse_ST_packet(void) UINT8 bytes = 0; UINT8 i; - print_command(FALSE); + print_command(FALSE, FALSE); // Clear out our name array for (i=0; i < FLASH_NAME_LENGTH+1; i++) @@ -3598,7 +3598,7 @@ void parse_QT_packet(void) unsigned char name[FLASH_NAME_LENGTH+1]; UINT8 i; - print_command(TRUE); + print_command(FALSE, TRUE); // Clear out our name array for (i=0; i < FLASH_NAME_LENGTH+1; i++) diff --git a/EBB_firmware/app.X/source/UBW.h b/EBB_firmware/app.X/source/UBW.h index 54745da..6c57458 100644 --- a/EBB_firmware/app.X/source/UBW.h +++ b/EBB_firmware/app.X/source/UBW.h @@ -162,7 +162,7 @@ void low_ISR (void); void high_ISR (void); ExtractReturnType extract_number (ExtractType Type, void * ReturnValue, unsigned char Required); UINT8 extract_string (unsigned char * ReturnValue, UINT8 MaxBytes); -void print_command(BOOL print_comma); +void print_command(BOOL print_always, BOOL print_comma); void print_line_ending(tLineEnding); void SetPinTRISFromRPn (char Pin, char State); void SetPinLATFromRPn (char Pin, char State); diff --git a/EBB_firmware/app.X/source/ebb.c b/EBB_firmware/app.X/source/ebb.c index 0d88d4a..a93da71 100644 --- a/EBB_firmware/app.X/source/ebb.c +++ b/EBB_firmware/app.X/source/ebb.c @@ -1485,7 +1485,7 @@ void parse_SC_packet (void) unsigned char Para1 = 0; unsigned int Para2 = 0; - print_command(FALSE); + print_command(FALSE, FALSE); // Extract each of the values. extract_number(kUCHAR, &Para1, kREQUIRED); @@ -1739,7 +1739,7 @@ void parse_LM_packet(void) UINT32 ClearAccs = 0; ExtractReturnType ClearRet; - print_command(FALSE); + print_command(FALSE, FALSE); // Extract each of the values. extract_number(kLONG, &Rate1, kREQUIRED); @@ -1830,7 +1830,7 @@ void parse_L3_packet(void) UINT32 ClearAccs = 0; ExtractReturnType ClearRet; - print_command(FALSE); + print_command(FALSE, FALSE); // Extract each of the values. extract_number(kLONG, &Rate1, kREQUIRED); @@ -1919,7 +1919,7 @@ void parse_T3_packet(void) UINT32 ClearAccs = 0; ExtractReturnType ClearRet; - print_command(FALSE); + print_command(FALSE, FALSE); // Extract each of the values. extract_number(kULONG, &Intervals, kREQUIRED); @@ -1990,7 +1990,7 @@ void parse_LT_packet(void) UINT32 ClearAccs = 0; ExtractReturnType ClearRet; - print_command(FALSE); + print_command(FALSE, FALSE); // Extract each of the values. extract_number(kULONG, &Intervals, kREQUIRED); @@ -2270,7 +2270,7 @@ void parse_SM_packet(void) INT32 Steps = 0; UINT8 ClearAccs = 0; - print_command(FALSE); + print_command(FALSE, FALSE); // Extract each of the values. extract_number(kULONG, &Duration, kREQUIRED); @@ -2413,7 +2413,7 @@ void parse_HM_packet(void) BOOL CommandExecuting = TRUE; INT32 XSteps = 0; - print_command(FALSE); + print_command(FALSE, FALSE); // Extract the step rate. extract_number(kULONG, &StepRate, kREQUIRED); @@ -2603,7 +2603,7 @@ void parse_XM_packet(void) INT32 Steps = 0; UINT8 ClearAccs = 0; - print_command(FALSE); + print_command(FALSE, FALSE); // Extract each of the values. extract_number(kULONG, &Duration, kREQUIRED); @@ -2989,7 +2989,7 @@ void parse_ES_packet(void) UINT32 fifo_steps1 = 0; UINT32 fifo_steps2 = 0; - print_command(FALSE); + print_command(FALSE, FALSE); // Extract each of the value. extract_number(kUCHAR, &disable_motors, kOPTIONAL); @@ -3077,7 +3077,7 @@ void parse_ES_packet(void) // Returns: 0 for down, 1 for up, then OK void parse_QP_packet(void) { - print_command(TRUE); + print_command(FALSE, TRUE); printf((far rom char *)"%d", PenState); print_line_ending(kLE_REV); @@ -3101,7 +3101,7 @@ void parse_QE_packet(void) UINT8 motor2_state = 0; UINT8 temp; - print_command(TRUE); + print_command(FALSE, TRUE); if (MS1_IO_PORT == 0u && MS2_IO_PORT == 0u && MS3_IO_PORT == 0u) { @@ -3163,7 +3163,7 @@ void parse_TP_packet(void) { UINT16 CommandDuration = 0; - print_command(FALSE); + print_command(FALSE, FALSE); // Extract each of the values. extract_number (kUINT, &CommandDuration, kOPTIONAL); @@ -3214,7 +3214,7 @@ void parse_SP_packet(void) UINT8 Pin = DEFAULT_EBB_SERVO_PORTB_PIN; ExtractReturnType Ret; - print_command(FALSE); + print_command(FALSE, FALSE); // Extract each of the values. extract_number(kUCHAR, &State, kREQUIRED); @@ -3319,7 +3319,7 @@ void parse_EM_packet(void) unsigned char EA1, EA2; ExtractReturnType RetVal1, RetVal2; - print_command(FALSE); + print_command(FALSE, FALSE); // Extract each of the values. RetVal1 = extract_number (kUCHAR, &EA1, kREQUIRED); @@ -3353,7 +3353,7 @@ void parse_EM_packet(void) // Usage: NI void parse_NI_packet(void) { - print_command(FALSE); + print_command(FALSE, FALSE); if (NodeCount < 0xFFFFFFFEUL) { @@ -3366,7 +3366,7 @@ void parse_NI_packet(void) // Usage: ND void parse_ND_packet(void) { - print_command(FALSE); + print_command(FALSE, FALSE); if (NodeCount) { @@ -3383,7 +3383,7 @@ void parse_SN_packet(void) unsigned long Temp; ExtractReturnType RetVal; - print_command(FALSE); + print_command(FALSE, FALSE); RetVal = extract_number(kULONG, &Temp, kREQUIRED); if (kEXTRACT_OK == RetVal) @@ -3399,7 +3399,7 @@ void parse_SN_packet(void) // OK void parse_QN_packet(void) { - print_command(TRUE); + print_command(FALSE, TRUE); printf((far rom char*)"%010lu", NodeCount); print_line_ending(kLE_NORM); @@ -3411,7 +3411,7 @@ void parse_QN_packet(void) // Usage: SL, void parse_SL_packet(void) { - print_command(FALSE); + print_command(FALSE, FALSE); // Extract each of the values. extract_number(kUCHAR, &Layer, kREQUIRED); @@ -3431,7 +3431,7 @@ void parse_SL_packet(void) // OK void parse_QL_packet(void) { - print_command(TRUE); + print_command(FALSE, TRUE); printf((far rom char*)"%03i", Layer); print_line_ending(kLE_NORM); @@ -3445,7 +3445,7 @@ void parse_QL_packet(void) // OK void parse_QB_packet(void) { - print_command(TRUE); + print_command(FALSE, TRUE); printf((far rom char*)"%1i", ButtonPushed); print_line_ending(kLE_NORM); @@ -3475,7 +3475,7 @@ void parse_QC_packet(void) while (PIE1bits.ADIE); // Print out our results - print_command(TRUE); + print_command(FALSE, TRUE); printf((far rom char*)"%04i,%04i", ISR_A_FIFO[0], ISR_A_FIFO[11]); print_line_ending(kLE_NORM); @@ -3500,7 +3500,7 @@ void parse_QG_packet(void) { UINT8 result = process_QM(); - print_command(TRUE); + print_command(FALSE, TRUE); // process_QM() gives us the low 4 bits of our output result. result = result & 0x0F; @@ -3553,7 +3553,7 @@ void parse_SE_packet(void) UINT8 SEUseMotionQueue = FALSE; ExtractReturnType PowerExtract; - print_command(FALSE); + print_command(FALSE, FALSE); // Extract each of the values. extract_number(kUCHAR, &State, kREQUIRED); @@ -3723,7 +3723,7 @@ void parse_QM_packet(void) UINT8 FIFOStatus = 0; UINT8 result = process_QM(); - print_command(TRUE); + print_command(FALSE, TRUE); if (result & 0x01) { @@ -3758,7 +3758,7 @@ void parse_QS_packet(void) { INT32 step1, step2; - print_command(TRUE); + print_command(FALSE, TRUE); // Need to turn off high priority interrupts briefly here to read out value that ISR uses INTCONbits.GIEH = 0; // Turn high priority interrupts off @@ -3801,7 +3801,7 @@ void clear_StepCounters(void) // Note, as of 2.7.0 this also clears out the step accumulators as well void parse_CS_packet(void) { - print_command(FALSE); + print_command(FALSE, FALSE); clear_StepCounters(); diff --git a/docs/ebb.html b/docs/ebb.html index d20d871..87355e9 100644 --- a/docs/ebb.html +++ b/docs/ebb.html @@ -278,7 +278,8 @@
  • Command: A<CR>
  • -
  • Response: A,channel:value,channel:value . . . <CR><NL>
  • +
  • Response (default): A,channel:value,channel:value . . . <CR><NL>
  • +
  • Response (unified): A,channel:value,channel:value . . . <NL>
  • Firmware versions: v2.2.3 and newer
  • Execution: Immediate
  • Description: @@ -299,7 +300,10 @@

  • - Example Return Packet: A,00:0713,02:0241,05:0089:09:1004<CR><NL> if channels 0, 2, 5 and 9 are enabled. + Example Return Packet (default): A,00:0713,02:0241,05:0089:09:1004<CR><NL> if channels 0, 2, 5 and 9 are enabled. +
  • +
  • + Example Return Packet (unified): A,00:0713,02:0241,05:0089:09:1004<NL> if channels 0, 2, 5 and 9 are enabled.
  • NOTE 1: The EBB's analog inputs are only rated for up to 3.3 V. Be careful not to put higher voltages on them (including 5 V) or you may damage the pin. @@ -318,7 +322,8 @@
    • Command: AC,channel,enable<CR>
    • -
    • Response: OK<CR><NL>
    • +
    • Response (default): OK<CR><NL>
    • +
    • Response (unified): AC<NL>
    • Firmware versions: v2.2.3 and newer
    • Execution: Immediate
    • @@ -345,15 +350,16 @@
      • Command: BL<CR>
      • -
      • Response: OK<CR><NL>
      • +
      • Response (default):No response
      • +
      • Response (unified):No response
      • Firmware versions: v1.9.5 and newer (with changes)
      • Execution: Immediate
      • Description:

        Enter bootloader mode.

        - This command turns off interrupts and jumps into the bootloader, so that new firmware may be uploaded. This particular method of entering bootloader mode is unique in that no physical button presses are required. -

        + This command turns off interrupts and jumps into the bootloader, so that new firmware may be uploaded. This particular method of entering bootloader mode is unique in that no physical button presses are required. Once the EBB receives this command, no response is sent back to the PC. +

        Once in bootloader mode, the EBB will not be able to communicate using the same USB serial port method that the normal firmware commands use. A special bootloader PC application (that uses USB HID to communicate with the bootloader on the EBB) must be run in order to upload new firmware HEX files to the EBB.

        @@ -377,7 +383,8 @@ Command: C,PortA_IO,PortB_IO,PortC_IO,PortD_IO,PortE_IO<CR>
      • -
      • Response: OK<CR><NL>
      • +
      • Response (default): OK<CR><NL>
      • +
      • Response (unified): C<NL>
      • Firmware versions: All
      • Execution: Immediate
      • Arguments: