Skip to content

Commit c65d978

Browse files
committed
VCT: Properly complete the command
1 parent 240b6ef commit c65d978

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

Firmware/Tools/VcServerTest.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,7 @@ void radioRuntime(VC_SERIAL_MESSAGE_HEADER * header, uint8_t * data, uint8_t len
715715

716716
void radioCommandComplete(VC_SERIAL_MESSAGE_HEADER * header, uint8_t * data, uint8_t length)
717717
{
718+
int activeCommand;
718719
VC_COMMAND_COMPLETE_MESSAGE * vcMsg;
719720
uint8_t srcVc;
720721

@@ -746,14 +747,22 @@ void radioCommandComplete(VC_SERIAL_MESSAGE_HEADER * header, uint8_t * data, uin
746747
{
747748
if (pcActiveCommand < CMD_LIST_SIZE)
748749
{
749-
if (pcCommandVc < MAX_VC)
750+
activeCommand = pcActiveCommand;
751+
752+
//Done with the PC command
753+
COMMAND_COMPLETE(pcCommandQueue, pcActiveCommand);
754+
755+
//Determine if a VC command moved to the PC queue
756+
if ((pcCommandVc < MAX_VC)
757+
&& COMMAND_PENDING(virtualCircuitList[pcCommandVc].commandQueue,
758+
activeCommand))
750759
{
760+
//Done with the VC command
751761
COMMAND_COMPLETE(virtualCircuitList[pcCommandVc].commandQueue,
752762
virtualCircuitList[pcCommandVc].activeCommand);
753763
}
754-
COMMAND_COMPLETE(pcCommandQueue, pcActiveCommand);
755764
}
756-
else if (virtualCircuitList[pcCommandVc].activeCommand < CMD_LIST_SIZE)
765+
else if (virtualCircuitList[srcVc].activeCommand < CMD_LIST_SIZE)
757766
{
758767
//This was a VC command
759768
COMMAND_COMPLETE(virtualCircuitList[srcVc].commandQueue,

0 commit comments

Comments
 (0)