From 59b0020bcf13513b31380b11918266d17c4308a1 Mon Sep 17 00:00:00 2001 From: Gold87 <91761103+Gold872@users.noreply.github.com> Date: Mon, 20 Jan 2025 18:06:14 -0500 Subject: [PATCH 1/2] Fix auto-reconnect on windows localhost --- lib/src/services/socket.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/services/socket.dart b/lib/src/services/socket.dart index b5e5be3a6..cf5058596 100644 --- a/lib/src/services/socket.dart +++ b/lib/src/services/socket.dart @@ -24,7 +24,7 @@ class DashboardSocket extends BurtSocket { double get frequency => models.settings.network.connectionTimeout; /// Listens for incoming messages on a UDP socket and sends heartbeats to the [device]. - DashboardSocket({required super.device}) : super(port: null, quiet: true); + DashboardSocket({required super.device}) : super(port: null, quiet: true, keepDestination: true); @override Duration get heartbeatInterval => Duration(milliseconds: 1000 ~/ frequency); From 115028a7e0250010896ff0ca7e07a2cf614a38f8 Mon Sep 17 00:00:00 2001 From: Levi Lesches Date: Sun, 2 Feb 2025 17:30:04 -0500 Subject: [PATCH 2/2] Updated burt_network --- bin/science.dart | 28 ++++++++--------- lib/data.dart | 2 +- lib/src/data/protobuf.dart | 1 + pubspec.lock | 62 +++++++++++++++++++------------------- pubspec.yaml | 5 +-- 5 files changed, 50 insertions(+), 48 deletions(-) diff --git a/bin/science.dart b/bin/science.dart index 3398bc61c..7e0dc1e60 100644 --- a/bin/science.dart +++ b/bin/science.dart @@ -4,13 +4,13 @@ import "dart:convert"; import "dart:io"; import "package:protobuf/protobuf.dart" as proto; -import "package:burt_network/generated.dart"; +import "package:burt_network/protobuf.dart"; /// A cleaner name for any message generated by Protobuf. typedef Message = proto.GeneratedMessage; /// Return true to keep this data in the dataset, or false to remove it. -/// +/// /// Not only are the sensors on the rover wonky, but the CAN bus can corrupt data along the way. /// This function can be used to remove any unwanted bad data. bool shouldKeepData(Timestamp timestamp, ScienceData data) { @@ -21,25 +21,25 @@ bool shouldKeepData(Timestamp timestamp, ScienceData data) { if (data.humidity.isOutOfBounds(min: 0, max: 50)) return false; if (data.temperature.isOutOfBounds(min: 0, max: 100)) return false; - // Any other conditions should go here: + // Any other conditions should go here: if (elapsed >= 30 * 60) return false; return true; // if none of the above rules are broken, then keep this data } -/// Returns new data based on this one. To remove data, use [shouldKeepData] instead. -/// +/// Returns new data based on this one. To remove data, use [shouldKeepData] instead. +/// /// You shouldn't need this unless you specifically need to change the *values* of the data. For example, /// if the CO2 sensor was consistently 100ppm off, you could use this function to add 100ppm to each data. -/// -/// NOTE: Do not modify fields that are zero, because they are likely sent in another "packet". For +/// +/// NOTE: Do not modify fields that are zero, because they are likely sent in another "packet". For /// example, if you want to modify CO2 but `data.co2 == 0`, this packet could be, eg, a methane packet /// and isn't meant to have any CO2 data. WrappedMessage modifyData(Timestamp timestamp, ScienceData data) { // ignore: prefer_expression_function_bodies - // Example 1: Add 100 ppm to all CO2: + // Example 1: Add 100 ppm to all CO2: // if (data.co2 != 0) data.co2 += 100; - // - // Example 2: Add one second to all the timestamps: + // + // Example 2: Add one second to all the timestamps: // timestamp += Duration(seconds: 1) // Wrap the data and return it. Do not delete. @@ -50,17 +50,17 @@ WrappedMessage modifyData(Timestamp timestamp, ScienceData data) { // ignore: p /// Use this to add new data to your dataset. List newData = [ // Adds methane=1 for every second from t=1 to t=100 seconds - for (int t = 0; t < 100; t++) + for (int t = 0; t < 100; t++) ScienceData(methane: 1).wrap(DateTime.now().add(Duration(seconds: t))), // Adds some random methane in an increasing line between t=100 and t=200 seconds - for (int t = 100; t < 200; t++) + for (int t = 100; t < 200; t++) ScienceData(methane: t + random.nextDouble() * 20).wrap(DateTime.now().add(Duration(seconds: t))), // Adds completely random data for t=0 to t=20 seconds, for all three samples - for (int s = 0; s < 3; s++) + for (int s = 0; s < 3; s++) for (int t = 0; t < 20; t++) ScienceData( - // sample: s, + // sample: s, temperature: t + s + (random.nextInt(10).toDouble()), methane: t + s + (random.nextInt(7).toDouble()), co2: t + s + (random.nextInt(5).toDouble()), diff --git a/lib/data.dart b/lib/data.dart index 90b4a28ec..0d27f2dc8 100644 --- a/lib/data.dart +++ b/lib/data.dart @@ -10,7 +10,7 @@ /// library should import any other library. library data; -export "package:burt_network/generated.dart"; +export "package:burt_network/protobuf.dart"; export "src/data/metrics/arm.dart"; export "src/data/metrics/drive.dart"; diff --git a/lib/src/data/protobuf.dart b/lib/src/data/protobuf.dart index 81bd69071..7151cdeeb 100644 --- a/lib/src/data/protobuf.dart +++ b/lib/src/data/protobuf.dart @@ -136,6 +136,7 @@ extension DeviceUtils on Device { case Device.DRIVE: return "Drive"; case Device.BASE_STATION: return "Base Station"; case Device.ANTENNA: return "Antenna"; + case Device.RELAY: return "Relays"; } // Do not use default or else you'll lose exhaustiveness checking. throw ArgumentError("Unrecognized device: $this"); diff --git a/pubspec.lock b/pubspec.lock index 6269064ca..0b2edb5b8 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -21,10 +21,10 @@ packages: dependency: transitive description: name: async - sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63 url: "https://pub.dev" source: hosted - version: "2.11.0" + version: "2.12.0" audio_session: dependency: transitive description: @@ -37,19 +37,19 @@ packages: dependency: transitive description: name: boolean_selector - sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" burt_network: dependency: "direct main" description: - path: "." - ref: "2.1.0" - resolved-ref: "61c1952afe2210099ccde59220356db647dc79ae" - url: "https://github.com/BinghamtonRover/Networking.git" + path: burt_network + ref: "2.5.0" + resolved-ref: a52c8a984fcc4f6b022fa540c0ea13b55168ac22 + url: "https://github.com/BinghamtonRover/Rover-Code.git" source: git - version: "2.1.0" + version: "2.4.0" characters: dependency: transitive description: @@ -78,18 +78,18 @@ packages: dependency: transitive description: name: clock - sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.1.2" collection: dependency: "direct main" description: name: collection - sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf url: "https://pub.dev" source: hosted - version: "1.18.0" + version: "1.19.0" console: dependency: transitive description: @@ -134,10 +134,10 @@ packages: dependency: transitive description: name: fake_async - sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc" url: "https://pub.dev" source: hosted - version: "1.3.1" + version: "1.3.2" ffi: dependency: transitive description: @@ -303,18 +303,18 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec url: "https://pub.dev" source: hosted - version: "10.0.5" + version: "10.0.8" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 url: "https://pub.dev" source: hosted - version: "3.0.5" + version: "3.0.9" leak_tracker_testing: dependency: transitive description: @@ -399,10 +399,10 @@ packages: dependency: transitive description: name: path - sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.9.1" path_provider: dependency: "direct main" description: @@ -519,7 +519,7 @@ packages: dependency: transitive description: flutter source: sdk - version: "0.0.99" + version: "0.0.0" source_span: dependency: transitive description: @@ -540,10 +540,10 @@ packages: dependency: transitive description: name: stack_trace - sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377" url: "https://pub.dev" source: hosted - version: "1.11.1" + version: "1.12.0" stream_channel: dependency: transitive description: @@ -556,10 +556,10 @@ packages: dependency: transitive description: name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + sha256: "0bd04f5bb74fcd6ff0606a888a30e917af9bd52820b178eaa464beb11dca84b6" url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.4.0" term_glyph: dependency: transitive description: @@ -572,10 +572,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" + sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" url: "https://pub.dev" source: hosted - version: "0.7.2" + version: "0.7.3" typed_data: dependency: transitive description: @@ -684,10 +684,10 @@ packages: dependency: transitive description: name: vm_service - sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" + sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14" url: "https://pub.dev" source: hosted - version: "14.2.5" + version: "14.3.1" web: dependency: transitive description: @@ -729,5 +729,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.5.3 <4.0.0" + dart: ">=3.6.0 <4.0.0" flutter: ">=3.24.0" diff --git a/pubspec.yaml b/pubspec.yaml index 388fb3802..dde4b4d95 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -12,8 +12,9 @@ dependencies: sdk: flutter burt_network: git: - url: https://github.com/BinghamtonRover/Networking.git - ref: 2.1.0 + url: https://github.com/BinghamtonRover/Rover-Code.git + path: burt_network + ref: 2.5.0 file_picker: ^8.0.0+1 fl_chart: ^0.69.0 flutter_libserialport: ^0.4.0