implemented two shell commands

main
Jonas Arnold 4 years ago
parent 27e9306d1b
commit 0b9952e40f
  1. 8
      ADIS_tinyK22_SplitFlap/source/application.c
  2. 5
      ADIS_tinyK22_SplitFlap/source/multi-splitflap.c

@ -75,7 +75,15 @@ static void App_Task(void* pv){
// if queue recieved something
if(xQueueReceive(cmdQueueHandle, &cmd, pdMS_TO_TICKS(20)) == pdPASS){
switch (cmd.shellCmd) {
case Shell_Init_All_SF:
MultiSplitFlap_MoveAllToZeroPosition();
break;
case Shell_Identify_SF:
// params[0]=hwId, params[1]= setupId
MultiSplitFlap_SetHardwareIdentifier(cmd.params[1], cmd.params[0]);
break;
case Shell_Powerof_rpi:
default:
McuLog_error("Not implemented command recieved in App_Task. Command Id was <%i>", (int)cmd.shellCmd);

@ -117,14 +117,17 @@ bool MultiSplitFlap_Display(char sentence[]){
bool MultiSplitFlap_SetHardwareIdentifier(SetupIdentifier_t id, HardwareIdentifier_t hwId){
// number too high (not that many split flaps can be added to the combination)
if(id >= NUM_FLAPS){
McuLog_error("MultiSplitFlap_SetHardwareIdentifier failed because splitflap with setup id <%i> cannot exist.", id);
return false;
}
// number too high (not that many split flaps were added added to the combination)
if(id >= MultiSplitFlap_GetAmountOfAddedSplitFlaps()){
McuLog_error("MultiSplitFlap_SetHardwareIdentifier failed because splitflap with setup id <%i> was not yet added.", id);
return false;
}
// number negative
if(id < 0){
McuLog_error("MultiSplitFlap_SetHardwareIdentifier failed because given setup id <%i> is negative.", id);
return false;
}
@ -132,6 +135,8 @@ bool MultiSplitFlap_SetHardwareIdentifier(SetupIdentifier_t id, HardwareIdentifi
SF_Handle_t sfHandle = (SF_Handle_t)(getItem(*flapDict, flapKeys[id]));
// set hardware identifier
SF_SetHardwareIdentifier(sfHandle, hwId);
// log
McuLog_info("MultiSplitFlap_SetHardwareIdentifier successful. SetupId=%i HardwareId=%i.", id, hwId);
return true;
}

Loading…
Cancel
Save