Skip to content

Commit

Permalink
initial TailCoNTROL moves pass
Browse files Browse the repository at this point in the history
  • Loading branch information
Codel1417 committed Dec 15, 2024
1 parent 4cd12dd commit 9c2bb60
Show file tree
Hide file tree
Showing 85 changed files with 466 additions and 416 deletions.
Binary file modified android/app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-hdpi/ic_notification.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-mdpi/ic_notification.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-xhdpi/ic_notification.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-xxhdpi/ic_notification.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-xxxhdpi/ic_notification.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
23 changes: 23 additions & 0 deletions build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
targets:
$default:
builders:
json_serializable:
options:
# Options configure how source code is generated for every
# `@JsonSerializable`-annotated class in the package.
#
# The default value for each is listed.
any_map: false
checked: false
constructor: ""
create_factory: true
create_field_map: false
create_json_keys: false
create_per_field_to_json: false
create_to_json: true
disallow_unrecognized_keys: false
explicit_to_json: true
field_rename: none
generic_argument_factories: false
ignore_unannotated: false
include_if_null: true
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
607 changes: 304 additions & 303 deletions lib/Backend/Bluetooth/bluetooth_manager_plus.dart

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions lib/Backend/Definitions/Device/device_definition.dart
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ enum DeviceState { standby, runAction, busy }

enum GlowtipStatus { glowtip, noGlowtip, unknown }

enum tailControlStatus { tailControl, legacy, unknown }

@freezed
class BluetoothUartService with _$BluetoothUartService {
const factory BluetoothUartService({
Expand All @@ -143,6 +145,7 @@ final List<BluetoothUartService> uartServices = const [
bleRxCharacteristic: "0b646a19-371e-4327-b169-9632d56c0e84",
bleTxCharacteristic: "05e026d8-b395-4416-9f8a-c00d6c3781b9",
),
// TailCoNTROL uuids
BluetoothUartService(
bleDeviceService: "19F8ADE2-D0C6-4C0A-912A-30601D9B3060",
bleRxCharacteristic: "5E4D86AC-EF2F-466F-A857-8776D45FFBC2",
Expand Down Expand Up @@ -181,6 +184,8 @@ class BaseStatefulDevice {
final ValueNotifier<GearConfigInfo> gearConfigInfo = ValueNotifier(GearConfigInfo());
final ValueNotifier<FWInfo?> fwInfo = ValueNotifier(null);
final ValueNotifier<bool> hasUpdate = ValueNotifier(false);
final ValueNotifier<tailControlStatus> isTailCoNTROL = ValueNotifier(tailControlStatus.unknown);

late final Stream<String> rxCharacteristicStream;
late final CommandQueue commandQueue;
List<FlSpot> batlevels = [];
Expand Down Expand Up @@ -219,6 +224,22 @@ class BaseStatefulDevice {
batlevels.add(FlSpot(stopWatch.elapsed.inSeconds.toDouble(), batteryLevel.value));
batteryLow.value = batteryLevel.value < 20;
});

bluetoothUartService.addListener(
() {
if (bluetoothUartService.value == null) {
isTailCoNTROL.value = tailControlStatus.unknown;
return;
}

isTailCoNTROL.value = bluetoothUartService.value ==
uartServices.firstWhere(
(element) => element.bleDeviceService == "19F8ADE2-D0C6-4C0A-912A-30601D9B3060",
)
? tailControlStatus.tailControl
: tailControlStatus.legacy;
},
);
}

@override
Expand Down
97 changes: 36 additions & 61 deletions lib/Backend/action_registry.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ActionRegistry {
CommandAction(
name: "Slow 1",
command: "TAILS1",
deviceCategory: [DeviceType.tail, DeviceType.wings, DeviceType.miniTail],
deviceCategory: [DeviceType.tail, DeviceType.wings, DeviceType.miniTail, DeviceType.ears],
actionCategory: ActionCategory.calm,
response: "TAILS1 END",
uuid: "c53e980e-899e-4148-a13e-f57a8f9707f4",
Expand All @@ -33,7 +33,7 @@ class ActionRegistry {
CommandAction(
name: "Slow 2",
command: "TAILS2",
deviceCategory: [DeviceType.tail, DeviceType.wings, DeviceType.miniTail],
deviceCategory: [DeviceType.tail, DeviceType.wings, DeviceType.miniTail, DeviceType.ears],
actionCategory: ActionCategory.calm,
response: "TAILS2 END",
uuid: "eb1bdfe7-d374-4e97-943a-13e89f27ddcd",
Expand All @@ -44,7 +44,7 @@ class ActionRegistry {
CommandAction(
name: "Slow 3",
command: "TAILS3",
deviceCategory: [DeviceType.tail, DeviceType.wings, DeviceType.miniTail],
deviceCategory: [DeviceType.tail, DeviceType.wings, DeviceType.miniTail, DeviceType.ears],
actionCategory: ActionCategory.calm,
response: "TAILS3 END",
uuid: "6937b9af-3ff7-43fb-ae62-a403e5dfaf95",
Expand All @@ -55,7 +55,7 @@ class ActionRegistry {
CommandAction(
name: "Fast",
command: "TAILFA",
deviceCategory: [DeviceType.tail, DeviceType.wings, DeviceType.miniTail],
deviceCategory: [DeviceType.tail, DeviceType.wings, DeviceType.miniTail, DeviceType.ears],
actionCategory: ActionCategory.fast,
response: "TAILFA END",
uuid: "a04b558f-0ad5-410f-8e39-8f5c594791d2",
Expand All @@ -66,7 +66,7 @@ class ActionRegistry {
CommandAction(
name: "Short",
command: "TAILSH",
deviceCategory: [DeviceType.tail, DeviceType.wings],
deviceCategory: [DeviceType.tail, DeviceType.wings, DeviceType.ears],
actionCategory: ActionCategory.fast,
response: "TAILSH END",
uuid: "05a4c47b-45ee-4da8-bec2-4a46f4e04a7f",
Expand All @@ -77,7 +77,7 @@ class ActionRegistry {
CommandAction(
name: "Happy",
command: "TAILHA",
deviceCategory: [DeviceType.tail, DeviceType.wings],
deviceCategory: [DeviceType.tail, DeviceType.wings, DeviceType.ears],
actionCategory: ActionCategory.fast,
response: "TAILHA END",
uuid: "86b13d13-b09c-46ba-a887-b40d8118b00a",
Expand All @@ -88,7 +88,7 @@ class ActionRegistry {
CommandAction(
name: "Stand Up",
command: "TAILER",
deviceCategory: [DeviceType.tail, DeviceType.wings],
deviceCategory: [DeviceType.tail, DeviceType.wings, DeviceType.ears],
actionCategory: ActionCategory.fast,
response: "TAILER END",
uuid: "5b04ca3d-a22a-4aff-8f40-99363248fcaa",
Expand All @@ -99,7 +99,7 @@ class ActionRegistry {
CommandAction(
name: "Pulse",
command: "TAILEP",
deviceCategory: [DeviceType.tail, DeviceType.wings],
deviceCategory: [DeviceType.tail, DeviceType.wings, DeviceType.ears],
actionCategory: ActionCategory.tense,
response: "TAILEP END",
uuid: "39bbe39d-aa92-4189-ac90-4bb821a59f5e",
Expand All @@ -110,7 +110,7 @@ class ActionRegistry {
CommandAction(
name: "Tremble 1",
command: "TAILT1",
deviceCategory: [DeviceType.tail, DeviceType.wings],
deviceCategory: [DeviceType.tail, DeviceType.wings, DeviceType.ears],
actionCategory: ActionCategory.tense,
response: "TAILT1 END",
uuid: "8cc3fc60-b8d2-4f22-810a-1e042d3984f7",
Expand All @@ -121,7 +121,7 @@ class ActionRegistry {
CommandAction(
name: "Tremble 2",
command: "TAILT2",
deviceCategory: [DeviceType.tail, DeviceType.wings],
deviceCategory: [DeviceType.tail, DeviceType.wings, DeviceType.ears],
actionCategory: ActionCategory.tense,
response: "TAILT2 END",
uuid: "123557a2-5489-43da-99e2-da37a36f055a",
Expand All @@ -132,7 +132,7 @@ class ActionRegistry {
CommandAction(
name: "Tremble 3",
command: "TAILET",
deviceCategory: [DeviceType.tail, DeviceType.wings],
deviceCategory: [DeviceType.tail, DeviceType.wings, DeviceType.ears],
actionCategory: ActionCategory.tense,
response: "TAILET END",
uuid: "4909d4c2-0054-4f16-9589-6273ef6bf6c9",
Expand All @@ -143,49 +143,49 @@ class ActionRegistry {
CommandAction(
name: "LEDs off",
command: "LEDOFF",
deviceCategory: [DeviceType.tail, DeviceType.miniTail],
deviceCategory: [DeviceType.tail, DeviceType.miniTail, DeviceType.ears],
actionCategory: ActionCategory.glowtip,
uuid: "6b2a7fae-b58c-43f3-81bf-070aa21c2242",
),
CommandAction(
name: "Rectangle wave",
command: "LEDREC",
deviceCategory: [DeviceType.tail, DeviceType.miniTail],
deviceCategory: [DeviceType.tail, DeviceType.miniTail, DeviceType.ears],
actionCategory: ActionCategory.glowtip,
uuid: "34269c91-90bd-4a34-851d-d49daa6ac863",
),
CommandAction(
name: "Triangle wave",
command: "LEDTRI",
deviceCategory: [DeviceType.tail, DeviceType.miniTail],
deviceCategory: [DeviceType.tail, DeviceType.miniTail, DeviceType.ears],
actionCategory: ActionCategory.glowtip,
uuid: "64142e0b-4cc0-4b1e-845f-9c560875f993",
),
CommandAction(
name: "Sawtooth wave",
command: "LEDSAW",
deviceCategory: [DeviceType.tail, DeviceType.miniTail],
deviceCategory: [DeviceType.tail, DeviceType.miniTail, DeviceType.ears],
actionCategory: ActionCategory.glowtip,
uuid: "047b84ad-3eb8-4d9c-b59b-13186cf965ca",
),
CommandAction(
name: "SOS",
command: "LEDSOS",
deviceCategory: [DeviceType.tail, DeviceType.miniTail],
deviceCategory: [DeviceType.tail, DeviceType.miniTail, DeviceType.ears],
actionCategory: ActionCategory.glowtip,
uuid: "66164945-840f-4302-b27c-e7a7623bf475",
),
CommandAction(
name: "Beacon",
command: "LEDBEA",
deviceCategory: [DeviceType.tail, DeviceType.miniTail],
deviceCategory: [DeviceType.tail, DeviceType.miniTail, DeviceType.ears],
actionCategory: ActionCategory.glowtip,
uuid: "4955a936-7703-4ce6-8d4a-b18857c0ea0a",
),
CommandAction(
name: "Flame",
command: "LEDFLA",
deviceCategory: [DeviceType.tail, DeviceType.miniTail],
deviceCategory: [DeviceType.tail, DeviceType.miniTail, DeviceType.ears],
actionCategory: ActionCategory.glowtip,
uuid: "e46566b4-1071-4866-815b-1aefbf06b573",
),
Expand Down Expand Up @@ -282,6 +282,9 @@ class GetAvailableActions extends _$GetAvailableActions {
baseStatefulDevice.hasGlowtip
..removeListener(_listener)
..addListener(_listener);
baseStatefulDevice.isTailCoNTROL
..removeListener(_listener)
..addListener(_listener);
}
return getState();
}
Expand All @@ -295,6 +298,21 @@ class GetAvailableActions extends _$GetAvailableActions {
for (BaseStatefulDevice baseStatefulDevice in availableGear) {
// check if command matches device type
if (baseAction.deviceCategory.contains(baseStatefulDevice.baseDeviceDefinition.deviceType) && ((baseAction.actionCategory == ActionCategory.glowtip && baseStatefulDevice.hasGlowtip.value == GlowtipStatus.glowtip) || baseAction.actionCategory != ActionCategory.glowtip)) {
if (baseAction.deviceCategory.contains(DeviceType.ears)) {
// Handle migrating ears to unified firmware
if (baseStatefulDevice.isTailCoNTROL.value == tailControlStatus.tailControl) {
// skip legacy moves
if (baseAction is EarsMoveList) {
continue;
}
// skip unified moves for legacy firmware ears
} else if (baseStatefulDevice.isTailCoNTROL.value == tailControlStatus.legacy) {
if (baseAction is CommandAction) {
continue;
}
}
}

// get category if it exists
if (sortedActions.containsKey(baseAction.actionCategory)) {
baseActions = sortedActions[baseAction.actionCategory];
Expand Down Expand Up @@ -347,49 +365,6 @@ BuiltMap<ActionCategory, BuiltSet<BaseAction>> getAllActions(GetAllActionsRef re
);
}

@Riverpod(keepAlive: true)
BuiltMap<ActionCategory, BuiltSet<BaseAction>> getAllActionsFiltered(GetAllActionsFilteredRef ref, BuiltSet<DeviceType> deviceType) {
Map<ActionCategory, Set<BaseAction>> sortedActions = {};
final BuiltMap<ActionCategory, BuiltSet<BaseAction>> read = ref.watch(getAllActionsProvider);
for (BaseAction baseAction in read.values.flattened) {
Set<BaseAction>? baseActions = {};
// check if command matches device type
if (baseAction.deviceCategory.toBuiltSet().intersection(deviceType).isNotEmpty) {
// get category if it exists
if (sortedActions.containsKey(baseAction.actionCategory)) {
baseActions = sortedActions[baseAction.actionCategory];
}
// add action to category
baseActions?.add(baseAction);
}
// store result
if (baseActions != null && baseActions.isNotEmpty) {
sortedActions[baseAction.actionCategory] = baseActions;
}
}
return BuiltMap(
sortedActions.map(
(key, value) => MapEntry(key, value.build()),
),
);
}

@Riverpod(keepAlive: true)
BuiltList<BaseAction> getAllActionsForCategory(GetAllActionsForCategoryRef ref, ActionCategory actionCategory) {
final BuiltMap<ActionCategory, BuiltSet<BaseAction>> allActions = ref.watch(getAllActionsProvider);
if (allActions.containsKey(actionCategory)) {
return allActions[actionCategory]!.toBuiltList();
}
return BuiltList();
}

BuiltList<BaseAction> splitBaseAction(BaseAction baseAction) {
if (baseAction.deviceCategory.length <= 1) {
return [baseAction].build();
}
return BuiltList();
}

@Riverpod(keepAlive: true)
BaseAction? getActionFromUUID(GetActionFromUUIDRef ref, String? uuid) {
if (uuid == null) {
Expand Down
5 changes: 3 additions & 2 deletions lib/Backend/move_lists.dart
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ class MoveLists extends _$MoveLists {
}
}

//TODO: move the core running moves OUT of move_lists
Future<void> runAction(BaseAction action, BaseStatefulDevice device) async {
//cursed handling of ears specifically
//TODO: Remove with TAILCoNTROL update
Expand Down Expand Up @@ -213,7 +214,7 @@ Future<void> runAction(BaseAction action, BaseStatefulDevice device) async {
} else if (action is MoveList) {
sequencesLogger.info("Starting MoveList ${action.name}.");
//plausible.event(name: "Run Sequence", props: {"Sequence Repeat": action.repeat.toInt().toString(), "Sequence Device Type": device.baseDeviceDefinition.deviceType.name, "Sequence Moves": action.moves.length.toString()});
if (action.moves.isNotEmpty && action.moves.length <= 5 && device.baseDeviceDefinition.deviceType != DeviceType.ears) {
if (action.moves.isNotEmpty && action.moves.length <= 5 && (device.baseDeviceDefinition.deviceType != DeviceType.ears || device.isTailCoNTROL.value == tailControlStatus.tailControl)) {
int preset = 1; //TODO: store
String cmd = "USERMOVE U${preset}P${action.moves.length}N${action.repeat.toInt()}";
String a = ''; // servo 1 position
Expand Down Expand Up @@ -282,7 +283,7 @@ List<BluetoothMessage> generateMoveCommand(Move move, BaseStatefulDevice device,
List<BluetoothMessage> commands = [];
if (move.moveType == MoveType.home) {
//TODO: Remove for TAILCoNTROL update
if (device.baseDeviceDefinition.deviceType == DeviceType.ears) {
if (device.baseDeviceDefinition.deviceType == DeviceType.ears && device.isTailCoNTROL.value != tailControlStatus.tailControl) {
commands.add(BluetoothMessage(message: "EARHOME", device: device, priority: priority, responseMSG: noResponseMsg ? null : "EARHOME END", type: type, timestamp: DateTime.now()));
} else {
commands.add(BluetoothMessage(message: "TAILHM", device: device, priority: priority, responseMSG: noResponseMsg ? null : "END TAILHM", type: type, timestamp: DateTime.now()));
Expand Down
Loading

0 comments on commit 9c2bb60

Please sign in to comment.