Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r4a41a54d255afc5cef0599e2a832927ed2b0ee5d -r37cfaa86d4307dfb4096e94270d2f29afc900b86 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 4a41a54d255afc5cef0599e2a832927ed2b0ee5d) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 37cfaa86d4307dfb4096e94270d2f29afc900b86) @@ -72,8 +72,6 @@ static g_dmaCTRL pcDMAXmitControlRecord; // DMA transmit control record (UART-debug) static g_dmaCTRL pcDMARecvControlRecord; // DMA receive control record (UART-debug) -static volatile BOOL canXmitSucceeded = FALSE; // indicates that the last CAN packet transmitted was successful - static volatile BOOL dgIsCommunicating = FALSE; // has DG sent a message since last check static volatile BOOL uiIsCommunicating = FALSE; // has UI sent a message since last check static volatile BOOL uiDidCommunicate = FALSE; // has UI every sent a message @@ -252,11 +250,10 @@ // message interrupt is for a transmit message box? if ( TRUE == isCANBoxForXmit( srcCANBox ) ) { - //U32 bytesXmitted = transmitNextCANPacket(); + U32 bytesXmitted = transmitNextCANPacket(); - //if ( 0 == bytesXmitted ) + if ( 0 == bytesXmitted ) { - canXmitSucceeded = TRUE; signalCANXmitsCompleted(); } } @@ -485,43 +482,33 @@ static U32 transmitNextCANPacket( void ) { U32 result = 0; - while ( 1 ) // TODO - add timeout and/or max packets per call + COMM_BUFFER_T buffer = findNextHighestPriorityCANPacketToTransmit(); + + // if a buffer is found with a packet to transmit, get packet from buffer and transmit it + if ( buffer != COMM_BUFFER_NOT_USED ) { - COMM_BUFFER_T buffer = findNextHighestPriorityCANPacketToTransmit(); + U08 data[ CAN_MESSAGE_PAYLOAD_SIZE ]; + U32 dataSize = getFromCommBuffer( buffer, data, CAN_MESSAGE_PAYLOAD_SIZE ); + CAN_MESSAGE_BOX_T mBox = buffer; // CAN message boxes and comm buffers are aligned - // if a buffer is found with a packet to transmit, get packet from buffer and transmit it - if ( buffer != COMM_BUFFER_NOT_USED ) + // if there's another CAN packet to send, send it + if ( dataSize == CAN_MESSAGE_PAYLOAD_SIZE ) { - U08 data[ CAN_MESSAGE_PAYLOAD_SIZE ]; - U32 dataSize = getFromCommBuffer( buffer, data, CAN_MESSAGE_PAYLOAD_SIZE ); - CAN_MESSAGE_BOX_T mBox = buffer; // CAN message boxes and comm buffers are aligned - - // if there's another CAN packet to send, send it - if ( dataSize == CAN_MESSAGE_PAYLOAD_SIZE ) + signalCANXmitsInitiated(); + if ( 0 != canTransmit( canREG1, mBox, data ) ) { - signalCANXmitsInitiated(); - if ( 0 != canTransmit( canREG1, mBox, data ) ) - { - result = CAN_MESSAGE_PAYLOAD_SIZE; - - canXmitSucceeded = FALSE; - while ( FALSE == canXmitSucceeded ); // TODO - add timeout (2ms) - } - else - { - signalCANXmitsCompleted(); - // TODO - shouldn't get here, but let's see if we do - SET_ALARM_WITH_1_U32_DATA( ALARM_ID_SOFTWARE_FAULT, (U32)mBox ) - } + result = CAN_MESSAGE_PAYLOAD_SIZE; } else - { // TODO - shouldn't get here - just testing - set first data to new s/w fault enum later - SET_ALARM_WITH_2_U32_DATA( ALARM_ID_SOFTWARE_FAULT, (U32)buffer, (U32)dataSize ) + { + signalCANXmitsCompleted(); + // TODO - shouldn't get here, but let's see if we do + SET_ALARM_WITH_1_U32_DATA( ALARM_ID_SOFTWARE_FAULT, (U32)mBox ) } } else - { - break; + { // TODO - shouldn't get here - just testing - set first data to new s/w fault enum later + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_SOFTWARE_FAULT, (U32)buffer, (U32)dataSize ) } } @@ -844,6 +831,14 @@ handleTestAlarmStatusBroadcastIntervalOverrideRequest( message ); break; + case MSG_ID_BLOOD_PUMP_MEAS_SPEED_OVERRIDE: + handleTestBloodPumpMeasuredSpeedOverrideRequest( message ); + break; + + case MSG_ID_BLOOD_PUMP_MEAS_ROTOR_SPEED_OVERRIDE: + handleTestBloodPumpRotorMeasuredSpeedOverrideRequest( message ); + break; + case MSG_ID_DIAL_FLOW_SET_PT_OVERRIDE: handleTestDialFlowSetPointOverrideRequest( message ); break;