Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
djuseeq authored Apr 2, 2019
1 parent f65f7aa commit eb16934
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Ch376msc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,14 @@ uint8_t Ch376msc::pingDevice(){
uint8_t Ch376msc::setMode(uint8_t mode){
sendCommand(CMD_SET_USB_MODE);
_comPort->write(mode);
delayMicroseconds(600);
_tmpReturn = adatUsbTol();
_ul_oldMillis = millis();
while(!_comPort->available()){
//wait for the second byte 0x15 or 0x16 or timeout occurs
if((millis()-_ul_oldMillis) > TIMEOUT){
break;
}
}
checkCH();

return _tmpReturn; // success or fail
Expand Down Expand Up @@ -329,7 +335,7 @@ uint8_t Ch376msc::readFile(char* buffer, uint8_t b_num){ //buffer for reading, b
break;
case DONE:
fileProcesSTM = REQUEST;
buffer[_byteCounter++] = '\0';// NULL terminating char
buffer[_byteCounter] = '\0';// NULL terminating char
_byteCounter = 0;
bufferFull = true;
break;
Expand Down

0 comments on commit eb16934

Please sign in to comment.