Commit 2a8f20eb79baf1c252c00f945052ec45bc0e9637

Authored by Adhidarma Hadiwinoto
1 parent cba7eef40e
Exists in master

Optimasi readIMSI

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

... ... @@ -102,14 +102,17 @@ async function readIMSI() {
102 102 imsi = data.toString().trim();
103 103 logger.info(`IMSI: ${imsi}`);
104 104 }
  105 +
105 106 mutex.releaseLockWaitForOK();
106 107 });
107 108  
108 109 port.pipe(parserReadIMSI);
109 110 await writeToPortAndWaitForOK('AT+CIMI\r');
110   - await mutex.setLockWaitForOK();
111   - mutex.releaseLockWaitForOK();
  111 +
  112 + // selesai hanya jika lock sudah terbuka oleh parser
  113 + mutex.setLockWaitForOK();
112 114 port.unpipe(parserReadIMSI);
  115 + mutex.releaseLockWaitForCommand();
113 116 }
114 117  
115 118 async function querySignalStrength() {