Skip to content

Commit

Permalink
Disabled some logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Bing-Rover committed Feb 2, 2024
1 parent 7c9b342 commit 15f916c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions bin/motor.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import "package:subsystems/subsystems.dart";
import "package:burt_network/logging.dart";

const speed = [0, 0, 0x10, 0];
const speed = [0, 0, 0x9, 0xc4];

void main() async {
Logger.level = LogLevel.info;
await collection.init();
while (true) {
collection.can.can.sendMessage(id: 0x303, data: speed);
collection.can.can.sendMessage(id: 0x304, data: speed);
await Future<void>.delayed(const Duration(milliseconds: 500));
}
}
2 changes: 1 addition & 1 deletion lib/can.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class CanService {
/// Handles an incoming CAN message.
void onMessage(CanMessage message) {
final name = dataCanIDs[message.id];
logger.debug("Received CAN message (0x${message.id.toRadixString(16)}): ${message.data}. Name=${name ?? 'None'}");
// logger.debug("Received CAN message (0x${message.id.toRadixString(16)}): ${message.data}. Name=${name ?? 'None'}");
if (name == null) {
logger.warning("Received CAN message with unknown ID", body: "ID=0x${message.id.toRadixString(16)}");
return;
Expand Down
4 changes: 2 additions & 2 deletions lib/src/can/socket_ffi.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ class CanFFI implements CanSocket {
if (pointer.ref.length == 0) break;
count++;
if (count % 10 == 0) {
logger.warning("CAN Buffer is full", body: "Processed $count messages in one callback. Consider decreasing the CAN read interval.");
logger.warning("CAN Buffer is full", body: "Processed $count messages in one callback. Consider decreasing the CAN read interval.");
}
final message = CanMessage.fromPointer(pointer, isNative: true);
final message = CanMessage.fromPointer(pointer, isNative: true);
_controller.add(message);
}
}
Expand Down
8 changes: 4 additions & 4 deletions lib/src/serial/imu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,23 @@ class ImuReader {
void handleOsc(List<int> data) {
try {
final message = OSCMessage.fromBytes(data.sublist(20));
logger.debug("Received: $message");
// logger.debug("Received: $message");
final orientation = Orientation(
x: message.arguments[0] as double,
y: message.arguments[1] as double,
z: message.arguments[2] as double,
);
if (orientation.x.isZero() || orientation.y.isZero() || orientation.z.isZero()) return;
if (orientation.x > 360 || orientation.y > 360 || orientation.z > 360) {
logger.trace("Got invalid orientation", body: "x=${orientation.x}, y=${orientation.y}, z=${orientation.z}");
// logger.trace("Got invalid orientation", body: "x=${orientation.x}, y=${orientation.y}, z=${orientation.z}");
return;
}
logger.debug("Got orientation: x=${orientation.x}, y=${orientation.y}, z=${orientation.z}");
// logger.debug("Got orientation: x=${orientation.x}, y=${orientation.y}, z=${orientation.z}");
final position = RoverPosition(orientation: orientation);
collection.server.sendMessage(position);
} catch (error) {
final rawLine = utf8.decode(data.sublist(20), allowMalformed: true);
logger.debug("Got invalid line from IMU", body: rawLine);
// logger.debug("Got invalid line from IMU", body: rawLine);
}
}

Expand Down

0 comments on commit 15f916c

Please sign in to comment.