From e7c905091e56524a2c4b488fe94bfccf90518f19 Mon Sep 17 00:00:00 2001 From: Adhidarma Hadiwinoto <me@adhisimon.org> Date: Mon, 5 Aug 2019 21:22:57 +0700 Subject: [PATCH] Perbaikan delimiter setelah kirim sms --- lib/modem.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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(); -- 1.9.0