diff --git a/controller-server/configs/dancerTable.ts b/controller-server/configs/dancerTable.ts index 6532d3f96..0a2db90ee 100644 --- a/controller-server/configs/dancerTable.ts +++ b/controller-server/configs/dancerTable.ts @@ -242,38 +242,38 @@ const dancerTable: DancerData = { // connected: false, // interface: "wifi", // }, - // "B8:27:EB:BB:57:AD": { // 15 - // IP: "192.168.0.0", - // MAC: "B8:27:EB:BB:57:AD", - // dancer: "15_nian_1", - // hostname: "lightdance-15", - // connected: false, - // interface: "ethernet", - // }, - // "B8:27:EB:EE:02:F8": { // 15 - // IP: "192.168.0.0", - // MAC: "B8:27:EB:EE:02:F8", - // dancer: "15_nian_1", - // hostname: "lightdance-15", - // connected: false, - // interface: "wifi", - // }, - "B8:27:EB:3A:21:4F": { // 16 + "B8:27:EB:82:79:49": { // 15 IP: "192.168.0.0", - MAC: "B8:27:EB:3A:21:4F", + MAC: "B8:27:EB:82:79:49", dancer: "15_nian_1", hostname: "lightdance-15", connected: false, interface: "ethernet", }, - "B8:27:EB:6F:74:1A": { // 16 + "B8:27:EB:D7:2C:1C": { // 15 IP: "192.168.0.0", - MAC: "B8:27:EB:6F:74:1A", + MAC: "B8:27:EB:D7:2C:1C", dancer: "15_nian_1", hostname: "lightdance-15", connected: false, interface: "wifi", }, + "B8:27:EB:3A:21:4F": { // 16 + IP: "192.168.0.0", + MAC: "B8:27:EB:3A:21:4F", + dancer: "16_nian_2", + hostname: "lightdance-16", + connected: false, + interface: "ethernet", + }, + "B8:27:EB:6F:74:1A": { // 16 + IP: "192.168.0.0", + MAC: "B8:27:EB:6F:74:1A", + dancer: "16_nian_2", + hostname: "lightdance-16", + connected: false, + interface: "wifi", + }, "D8:3A:DD:22:AC:AA": { // 17 IP: "192.168.0.0", MAC: "D8:3A:DD:22:AC:AA", @@ -341,22 +341,7 @@ const dancerTable: DancerData = { }, // 22 replaced // 23 broken - "B8:27:EB:82:79:49": { // 24 - IP: "192.168.0.0", - MAC: "B8:27:EB:82:79:49", - dancer: "24", - hostname: "lightdance-24", - connected: false, - interface: "ethernet", - }, - "B8:27:EB:D7:2C:1C": { // 24 - IP: "192.168.0.0", - MAC: "B8:27:EB:D7:2C:1C", - dancer: "24", - hostname: "lightdance-24", - connected: false, - interface: "wifi", - } + // 24 replaced }; export const dancerToMAC: Record< diff --git a/controller-server/configs/pinMapTable.ts b/controller-server/configs/pinMapTable.ts index 222744cf9..0ba66ba5a 100644 --- a/controller-server/configs/pinMapTable.ts +++ b/controller-server/configs/pinMapTable.ts @@ -679,11 +679,10 @@ const pinMapTable: PinMapTable = { belly: 35, }, LEDPARTS: { - backfoot_right_LED: { id: 0, len: 57 }, - backfoot_left_LED: { id: 3, len: 30 }, + backfoot_right_LED: { id: 0, len: 120 }, + backfoot_left_LED: { id: 3, len: 70 }, back_LED: { id: 4, len: 76 }, tail_LED: { id: 5, len: 119 }, - slash_LED: { id: 6, len: 40 }, }, LEDPARTS_MERGE: {}, }, diff --git a/controller-server/websocket/controlPanel/index.ts b/controller-server/websocket/controlPanel/index.ts index 026fa90fe..c95bb12d4 100644 --- a/controller-server/websocket/controlPanel/index.ts +++ b/controller-server/websocket/controlPanel/index.ts @@ -39,6 +39,13 @@ export async function handleOnControlPanelMessage( handleSync(msg); break; case "play": + if (music_subprocess?.pid && !music_subprocess.killed) { + console.log(music_subprocess.pid+1); + try { + process.kill(music_subprocess.pid+1, 'SIGHUP') + } catch {} + console.log("killed music"); + } music_subprocess = handlePlay(msg); break; case "pause": diff --git a/editor-blender/operators/command_center/__init__.py b/editor-blender/operators/command_center/__init__.py index 627e4276c..27cf52749 100644 --- a/editor-blender/operators/command_center/__init__.py +++ b/editor-blender/operators/command_center/__init__.py @@ -434,6 +434,42 @@ async def async_execute(self, context: bpy.types.Context): return {"FINISHED"} +class CommandCenterForceStopOperator(AsyncOperator): + bl_idname = "lightdance.command_center_force_stop" + bl_label = "Force stop" + + @classmethod + def poll(cls, context: bpy.types.Context): + return True + + async def async_execute(self, context: bpy.types.Context): + try: + stop_payload = ToControllerServerStopPartial.from_dict( + {"topic": "stop", "payload": {"dancers": get_selected_dancer()}} + ) + + await command_agent.send_to_controller_server(stop_payload) + bpy.context.scene.frame_current = 0 + + sync_payload = ToControllerServerWebShellPartial.from_dict( + { + "topic": "webShell", + "payload": { + "dancers": get_selected_dancer(), + "command": f"sudo systemctl restart player.service", + }, + } + ) + + await command_agent.send_to_controller_server(sync_payload) + + except Exception as e: + traceback.print_exc() + + raise Exception(f"Can't send message to controller server: {e}") + return {"FINISHED"} + + ops_list = [ CommandCenterRefreshOperator, CommandCenterCloseGPIOOperator, @@ -449,6 +485,7 @@ async def async_execute(self, context: bpy.types.Context): CommandCenterTestOperator, CommandCenterUploadOperator, CommandCenterWebShellOperator, + CommandCenterForceStopOperator, ] diff --git a/editor-blender/panels/command_center/__init__.py b/editor-blender/panels/command_center/__init__.py index 273a200dd..e3d169496 100644 --- a/editor-blender/panels/command_center/__init__.py +++ b/editor-blender/panels/command_center/__init__.py @@ -177,6 +177,7 @@ def draw(self, context: bpy.types.Context): row.operator("lightdance.command_center_stop", text="", icon="SNAP_FACE") op = row.operator("screen.frame_jump", text="", icon="REW") setattr(op, "end", False) + row.operator("lightdance.command_center_force_stop", icon="CANCEL") column = split.column() row = column.row() row.prop( diff --git a/editor-server/src/routes/api/get_dancer_led_data.rs b/editor-server/src/routes/api/get_dancer_led_data.rs index 95af75770..74a65218a 100644 --- a/editor-server/src/routes/api/get_dancer_led_data.rs +++ b/editor-server/src/routes/api/get_dancer_led_data.rs @@ -113,15 +113,11 @@ fn filter_identical_frames(statuses: Vec) -> Vec { // Remove executive identical frames let mut keep_frame = vec![true; statuses.len()]; - for (i, (identical, fade)) in identical_and_fade.iter().enumerate() { - if !identical && *fade { - continue; - } - + for (i, (identical, _fade)) in identical_and_fade.iter().enumerate() { // Must keep if previous frame is not the same if i > 0 { let prev = identical_and_fade[i - 1]; - if !prev.0 || (!identical && prev.1) { + if !prev.0 || !identical { continue; } } else {