Skip to content

Commit

Permalink
Small logging updates
Browse files Browse the repository at this point in the history
  • Loading branch information
JovannMC committed Jul 7, 2024
1 parent 3c3e135 commit fa4e479
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/HaritoraX.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,9 @@ export default class HaritoraX extends EventEmitter {
* @example
* device.startConnection("COM");
**/
startConnection(connectionMode: string, portNames?: string[], heartbeatInterval: number = 10000): boolean {
if (!isConnectionModeSupported(connectionMode)) {
error(`Connection mode ${connectionMode} not supported for ${trackerModelEnabled}`);
return;
}
startConnection(connectionMode: string, portNames?: string[], heartbeatInterval: number = 10000) {
if (!isConnectionModeSupported(connectionMode))
error(`${connectionMode} connection not supported for ${trackerModelEnabled}`, true);

if (connectionMode === "com") {
com = new COM(trackerModelEnabled, heartbeatInterval);
Expand Down Expand Up @@ -741,7 +739,7 @@ export default class HaritoraX extends EventEmitter {
try {
await bluetooth.read(trackerName, trackerService, magnetometerCharacteristic);
} catch (err) {
error(`Error reading magnetometer status: ${err}`);
error(`Error reading mag status: ${err}`);
return null;
}
}
Expand Down Expand Up @@ -1436,7 +1434,7 @@ function processBatteryData(data: string, trackerName: string) {
logBatteryInfo(batteryData[0], batteryData[1], batteryData[2]);
} catch (err) {
error(`Error parsing battery data JSON for ${trackerName}: ${err}`);
error(`Raw battery data: ${data}`);
log(`Raw battery data: ${data}`);
}
} else if (trackerModelEnabled === "wireless" && isWirelessBT(trackerName) && bluetoothEnabled) {
try {
Expand Down

0 comments on commit fa4e479

Please sign in to comment.