Skip to content

Commit 793e699

Browse files
authored
Merge pull request #549 from LeeLeahy2/vct-program-updated
VCT: Add CHECK_FOR_UPDATE and PROGRAMMING_COMPLETED
2 parents 157a815 + 81c1bce commit 793e699

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

Firmware/Tools/VcServerTest.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,13 @@ typedef enum
110110
CMD_ATI8_2, //Get the radio's unique ID
111111
CMD_ATI11, //Get the runtime
112112

113+
//Determine if programming is necessary
114+
CHECK_FOR_UPDATE,
115+
116+
//Done programming
117+
CMD_ATI11_2, //Get the runtime
118+
PROGRAMMING_COMPLETED, //Configuration is up-to-date
119+
113120
//Last in the list
114121
CMD_LIST_SIZE
115122
} COMMANDS;
@@ -119,6 +126,8 @@ const char * const commandName[] =
119126
"ATI30", "ATIB", "ATI", "ATI8", "ATA", "AT-CMDVC", "ATC",
120127
"WAIT_CONNECT",
121128
"AT-CMDVC_2", "ATI31", "ATI_2", "ATI8_2", "ATI11",
129+
"CHECK_FOR_UPDATE",
130+
"ATI11_2", "PROGRAMMING_COMPLETED",
122131
};
123132

124133
typedef struct _VIRTUAL_CIRCUIT
@@ -128,6 +137,7 @@ typedef struct _VIRTUAL_CIRCUIT
128137
QUEUE_T commandQueue[COMMAND_QUEUE_SIZE];
129138
uint32_t commandTimer;
130139
uint64_t programmed;
140+
uint64_t programUpdated;
131141
uint64_t runtime;
132142
uint8_t uniqueId[UNIQUE_ID_BYTES];
133143
bool valid;
@@ -602,6 +612,9 @@ void radioToPcLinkStatus(VC_SERIAL_MESSAGE_HEADER * header, uint8_t * data, uint
602612
COMMAND_ISSUE(virtualCircuitList[srcVc].commandQueue,
603613
virtualCircuitList[srcVc].commandTimer,
604614
CMD_ATI11);
615+
COMMAND_ISSUE(virtualCircuitList[srcVc].commandQueue,
616+
virtualCircuitList[srcVc].commandTimer,
617+
CHECK_FOR_UPDATE);
605618
}
606619
break;
607620
}
@@ -1185,8 +1198,33 @@ bool issueVcCommands(int vcIndex)
11851198
return true;
11861199

11871200
case CMD_ATI11:
1201+
case CMD_ATI11_2:
11881202
sendVcCommand(GET_RUNTIME, vcIndex);
11891203
return true;
1204+
1205+
case CHECK_FOR_UPDATE:
1206+
if (virtualCircuitList[vcIndex].programUpdated > virtualCircuitList[vcIndex].programmed)
1207+
{
1208+
}
1209+
1210+
//Complete the programming
1211+
COMMAND_ISSUE(virtualCircuitList[vcIndex].commandQueue,
1212+
virtualCircuitList[vcIndex].commandTimer,
1213+
CMD_ATI11_2);
1214+
COMMAND_ISSUE(virtualCircuitList[vcIndex].commandQueue,
1215+
virtualCircuitList[vcIndex].commandTimer,
1216+
PROGRAMMING_COMPLETED);
1217+
1218+
//Done with the CHECK_FOR_UPDATE command
1219+
COMMAND_COMPLETE(virtualCircuitList[vcIndex].commandQueue,
1220+
virtualCircuitList[vcIndex].activeCommand);
1221+
return true;
1222+
1223+
case PROGRAMMING_COMPLETED:
1224+
virtualCircuitList[vcIndex].programmed = virtualCircuitList[vcIndex].runtime;
1225+
COMMAND_COMPLETE(virtualCircuitList[vcIndex].commandQueue,
1226+
virtualCircuitList[vcIndex].activeCommand);
1227+
return true;
11901228
}
11911229
}
11921230
}

0 commit comments

Comments
 (0)