Commit e7c905091e56524a2c4b488fe94bfccf90518f19

Authored by Adhidarma Hadiwinoto
1 parent 3244146220
Exists in master

Perbaikan delimiter setelah kirim sms

Showing 1 changed file with 2 additions and 3 deletions Side-by-side Diff

... ... @@ -2,8 +2,7 @@
2 2  
3 3 const INTERVAL_BEETWEN_SIGNAL_STRENGTH_MS = 60000;
4 4 const MAX_LAST_DATA_AGE_MS = 3 * 60 * 1000;
5   -// const REGEX_WAIT_FOR_OK_OR_ERROR = /\n(?:OK|ERROR)\r\n/;
6   -const REGEX_WAIT_FOR_OK_OR_ERROR = /(?:OK|ERROR)\r/;
  5 +const REGEX_WAIT_FOR_OK_OR_ERROR = /\n(?:OK|ERROR)\r/;
7 6  
8 7 const moment = require('moment');
9 8 const SerialPort = require('serialport');
... ... @@ -294,7 +293,7 @@ async function sendSMS(destination, msg) {
294 293 logger.verbose('Waiting for lock before writing message');
295 294 await mutex.setLockWaitForSubCommand();
296 295 port.pipe(parser);
297   - await writeToPort(`AT+CMGS="${correctedDestination}"\n${msg}${Buffer.from([0x1A])}`);
  296 + await writeToPort(`AT+CMGS="${correctedDestination}"\r${msg}${Buffer.from([0x1A])}`);
298 297  
299 298 await mutex.setLockWaitForSubCommand();
300 299 mutex.releaseLockWaitForSubCommand();