diff --git a/lib/modem.js b/lib/modem.js index 61b81b7..5307d8d 100644 --- a/lib/modem.js +++ b/lib/modem.js @@ -2,8 +2,7 @@ const INTERVAL_BEETWEN_SIGNAL_STRENGTH_MS = 60000; const MAX_LAST_DATA_AGE_MS = 3 * 60 * 1000; -// const REGEX_WAIT_FOR_OK_OR_ERROR = /\n(?:OK|ERROR)\r\n/; -const REGEX_WAIT_FOR_OK_OR_ERROR = /(?:OK|ERROR)\r/; +const REGEX_WAIT_FOR_OK_OR_ERROR = /\n(?:OK|ERROR)\r/; const moment = require('moment'); const SerialPort = require('serialport'); @@ -294,7 +293,7 @@ async function sendSMS(destination, msg) { logger.verbose('Waiting for lock before writing message'); await mutex.setLockWaitForSubCommand(); port.pipe(parser); - await writeToPort(`AT+CMGS="${correctedDestination}"\n${msg}${Buffer.from([0x1A])}`); + await writeToPort(`AT+CMGS="${correctedDestination}"\r${msg}${Buffer.from([0x1A])}`); await mutex.setLockWaitForSubCommand(); mutex.releaseLockWaitForSubCommand();