From 1d3d7f5f869d30270487457cc89c2253de3bdd65 Mon Sep 17 00:00:00 2001 From: PS Date: Thu, 8 Apr 2021 15:42:26 -1000 Subject: [PATCH 1/2] Making Motor Debug Commands more verbose --- src/app/ss_blumen_lumen/blumen_lumen.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/app/ss_blumen_lumen/blumen_lumen.cpp b/src/app/ss_blumen_lumen/blumen_lumen.cpp index be87d78..e2b7035 100644 --- a/src/app/ss_blumen_lumen/blumen_lumen.cpp +++ b/src/app/ss_blumen_lumen/blumen_lumen.cpp @@ -731,25 +731,25 @@ US_CUSTOM_DEBUG_UI(BlumenLumen_DebugUI) { ui_Label(I, Label); - bool IsClosed = PendingPacket.FlowerPositions[MotorIndex] == 1; + bool IsClosed = PendingPacket.FlowerPositions[MotorIndex] == MotorState_Closed; if (ui_ToggleText(I, MakeString("Closed (1)"), IsClosed)) { - PendingPacket.FlowerPositions[MotorIndex] = 1; + PendingPacket.FlowerPositions[MotorIndex] = MotorState_Closed; } - bool IsHOpen = PendingPacket.FlowerPositions[MotorIndex] == 3; + bool IsHOpen = PendingPacket.FlowerPositions[MotorIndex] == MotorState_HalfOpen; if (ui_ToggleText(I, MakeString("Half Open (3)"), IsHOpen)) { - PendingPacket.FlowerPositions[MotorIndex] = 3; + PendingPacket.FlowerPositions[MotorIndex] = MotorState_HalfOpen; } - bool IsMOpen = PendingPacket.FlowerPositions[MotorIndex] == 4; + bool IsMOpen = PendingPacket.FlowerPositions[MotorIndex] == MotorState_MostlyOpen; if (ui_ToggleText(I, MakeString("Mostly Open (4)"), IsMOpen)) { - PendingPacket.FlowerPositions[MotorIndex] = 4; + PendingPacket.FlowerPositions[MotorIndex] = MotorState_MostlyOpen; } - bool IsOpen = PendingPacket.FlowerPositions[MotorIndex] == 2; + bool IsOpen = PendingPacket.FlowerPositions[MotorIndex] == MotorState_Open; if (ui_ToggleText(I, MakeString("Open (2)"), IsOpen)) { - PendingPacket.FlowerPositions[MotorIndex] = 2; + PendingPacket.FlowerPositions[MotorIndex] = MotorState_Open; } } ui_EndRow(I); From 7a95861bf8ab5ff56847224922a34af07cfeed73 Mon Sep 17 00:00:00 2001 From: PS Date: Thu, 8 Apr 2021 16:06:58 -1000 Subject: [PATCH 2/2] Ability to override all assemblies in debug panel --- build/build_app_msvc_win32_debug.bat | 2 +- .../panels/foldhaus_panel_assembly_debug.h | 2 ++ .../engine/assembly/foldhaus_assembly_debug.h | 29 +++++++++++++++---- src/app/ss_blumen_lumen/blumen_lumen.h | 5 ---- .../ss_blumen_lumen/blumen_lumen_settings.h | 2 +- 5 files changed, 28 insertions(+), 12 deletions(-) diff --git a/build/build_app_msvc_win32_debug.bat b/build/build_app_msvc_win32_debug.bat index 7e14230..eec2df0 100644 --- a/build/build_app_msvc_win32_debug.bat +++ b/build/build_app_msvc_win32_debug.bat @@ -6,7 +6,7 @@ SET MyPath=%MyPath:~0,-1% call %MyPath%\_prebuild_win32.bat app debug msvc call %MyPath%\setup_cl.bat -SET CommonCompilerFlags=-nologo -DDEBUG=0 -DPLATFORM_WINDOWS -FC -WX -W4 -Z7 -Oi -GR- -EHsc -EHa- -MTd -fp:fast -fp:except- -IC:\programs-dev\gs_libs\src +SET CommonCompilerFlags=-nologo -DDEBUG=1 -DPLATFORM_WINDOWS -FC -WX -W4 -Z7 -Oi -GR- -EHsc -EHa- -MTd -fp:fast -fp:except- -IC:\programs-dev\gs_libs\src SET CommonCompilerFlags=-wd4127 -wd4702 -wd4101 -wd4505 -wd4100 -wd4189 -wd4244 -wd4201 -wd4996 -I%CommonLibs% -O2 %CommonCompilerFlags% diff --git a/src/app/editor/panels/foldhaus_panel_assembly_debug.h b/src/app/editor/panels/foldhaus_panel_assembly_debug.h index 5528a3a..d1c912e 100644 --- a/src/app/editor/panels/foldhaus_panel_assembly_debug.h +++ b/src/app/editor/panels/foldhaus_panel_assembly_debug.h @@ -66,6 +66,8 @@ AssemblyDebug_Render(panel* Panel, rect2 PanelBounds, render_command_buffer* Ren { InterfaceAssert(Interface->PerFrameMemory); + State->AssemblyDebugState.AllAssemblies = ui_ToggleText(Interface, MakeString("All Assemblies"), State->AssemblyDebugState.AllAssemblies); + gs_string OverrideStr = MakeString(OverrideTypeStrings[State->AssemblyDebugState.Override]); if (ui_BeginLabeledDropdown(Interface, MakeString("Override"), OverrideStr)) { diff --git a/src/app/engine/assembly/foldhaus_assembly_debug.h b/src/app/engine/assembly/foldhaus_assembly_debug.h index 2bf6f40..c7c59d8 100644 --- a/src/app/engine/assembly/foldhaus_assembly_debug.h +++ b/src/app/engine/assembly/foldhaus_assembly_debug.h @@ -42,6 +42,7 @@ struct assembly_debug_state { override_type Override; + bool AllAssemblies; u32 TargetAssembly; u32 TargetStrip; @@ -101,12 +102,9 @@ AssemblyDebug_OverrideTagValueWithColor(assembly Assembly, led_buffer LedBuffer, } internal void -AssemblyDebug_OverrideOutput(assembly_debug_state State, assembly_array Assemblies, led_system LedSystem) +AssemblyDebug_OverrideOutputForAssembly(assembly_debug_state State, led_system LedSystem, + assembly Assembly) { - if (State.Override == ADS_Override_None) return; - State.TargetColor = pixel{255,255,255}; - - assembly Assembly = Assemblies.Values[State.TargetAssembly]; led_buffer LedBuffer = LedSystem.Buffers[Assembly.LedBufferIndex]; u8 V = State.Brightness; @@ -203,6 +201,27 @@ AssemblyDebug_OverrideOutput(assembly_debug_state State, assembly_array Assembli } } +internal void +AssemblyDebug_OverrideOutput(assembly_debug_state State, assembly_array Assemblies, led_system LedSystem) +{ + if (State.Override == ADS_Override_None) return; + State.TargetColor = pixel{255,255,255}; + + if (State.AllAssemblies) + { + for (u32 i = 0; i < Assemblies.Count; i++) + { + assembly Assembly = Assemblies.Values[i]; + AssemblyDebug_OverrideOutputForAssembly(State, LedSystem, Assembly); + } + } + else + { + assembly Assembly = Assemblies.Values[State.TargetAssembly]; + AssemblyDebug_OverrideOutputForAssembly(State, LedSystem, Assembly); + } +} + #define FOLDHAUS_ASSEMBLY_DEBUG_H #endif // FOLDHAUS_ASSEMBLY_DEBUG_H \ No newline at end of file diff --git a/src/app/ss_blumen_lumen/blumen_lumen.h b/src/app/ss_blumen_lumen/blumen_lumen.h index 0a81e8f..5e98557 100644 --- a/src/app/ss_blumen_lumen/blumen_lumen.h +++ b/src/app/ss_blumen_lumen/blumen_lumen.h @@ -43,11 +43,6 @@ typedef struct motor_packet typedef struct motor_status_packet { motor_packet Pos; - /* -u8 Motor1Pos; -u8 Motor2Pos; -u8 Motor3Pos; -*/ u8 MotorStatus[3]; u16 Temperature; diff --git a/src/app/ss_blumen_lumen/blumen_lumen_settings.h b/src/app/ss_blumen_lumen/blumen_lumen_settings.h index abcb17d..46f69b8 100644 --- a/src/app/ss_blumen_lumen/blumen_lumen_settings.h +++ b/src/app/ss_blumen_lumen/blumen_lumen_settings.h @@ -67,7 +67,7 @@ r64 VoiceCommandSustainDuration = 30.0; // in seconds // NOTE: This is not a symmetric operation. When we send a 'motor open' // command, we want to immediately turn the upper leds on so they appear // to have been on the whole time. -r64 TurnUpperLedsOffAfterMotorCloseCommandDelay = 5.0; // in seconds +r64 TurnUpperLedsOffAfterMotorCloseCommandDelay = 30.0; // in seconds // NOTE: Temperature & Time of Day Based Led Brightness Settings