Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: src/command.cpp
- Revision:
- 5:09be5bbb5020
- Parent:
- 4:db38665c3727
- Child:
- 6:39442d493098
--- a/src/command.cpp Thu Nov 29 00:07:25 2018 +0000 +++ b/src/command.cpp Sat Dec 01 00:08:53 2018 +0000 @@ -39,8 +39,11 @@ #include "boards.h" #include "menu.h" +extern unsigned int boardsActive; +extern unsigned int boardMults; extern unsigned int binCode[6]; extern unsigned int thermCode[6]; +extern unsigned int commandData; /************* FILE SCOPE VARIABLES ************************/ char setvalue = FALSE; @@ -475,7 +478,18 @@ rxbuf[endofc] = 0; // Copy the command string into commandString - strcpy(commandString, &rxbuf[bufloc]); + char commandStringBuf[80]; + char *tok; + strcpy(commandStringBuf, &rxbuf[bufloc]); + if(strstr(commandStringBuf, "=")){ + tok = strtok(commandStringBuf, "="); + strcpy(commandString, tok); + tok = strtok(NULL, "="); + commandData = atoi(tok); + } + else{ + strcpy(commandString, commandStringBuf); + } // Convert the command string to all uppercase characters for (i = 0; i < strlen(commandString); i++) @@ -942,6 +956,7 @@ unsigned int data; char commandString[80] = { 0 }; + commandError = 0; parseCommand(GET, commandString); @@ -1290,7 +1305,6 @@ int channelNum, channelSide, numPoints, i, ival; char channelSideChar; unsigned int boardEnables; - unsigned int multiplier; char commandString[80] = { 0 }; @@ -1309,13 +1323,16 @@ } else if (!strcmp(commandString, "BRDS")) // BRDS is used to get/set the wr_out value. - // The integer value of multiplier is used to change wr_out via setBoardEnables(multiplier). + // The integer value of boardsActive is used to change wr_out via setBoardEnables(boardsActive). // Slots 12 to 0 are activated with the wr_out signals // wr_out[13] = slots[12:0] { + + boardsActive = commandData; + if (readback) { - sprintf(strbuf, " %d", multiplier); + sprintf(strbuf, " %d", boardsActive); sendSerial(strbuf); } //else if (running == 1) @@ -1325,22 +1342,24 @@ //} else { - if(checkRange(0, 63, multiplier) == 1){ + if(checkRange(boardsActive, 0, 63) == 1){ setBoardEnables(binCode); }else{ - showRangeError(1, multiplier, 0.0); + showRangeError(1, boardsActive, 0.0); } } } else if (!strcmp(commandString, "MULT")) // MULT is used to get/set the en_out value. - // The integer value of multiplier is used to change en_out via setBoardWeights(multiplier). + // The integer value of boardMults is used to change en_out via setBoardWeights(boardMults). // en_out are binary weighted signals that activate groups of DC-DC converters on the slot cards. // en_out[6] = {en32, en16, en8, en4, en2, en1} { + boardMults = commandData; + if (readback) { - sprintf(strbuf, " %d", multiplier); + sprintf(strbuf, " %d", boardMults); sendSerial(strbuf); } //else if (running == 1) @@ -1350,10 +1369,10 @@ //} else { - if(checkRange(0, 63, multiplier) == 1){ + if(checkRange(boardMults, 0, 63) == 1){ setBoardWeights(thermCode); }else{ - showRangeError(1, multiplier, 0.0); + showRangeError(1, boardMults, 0.0); } } }