Skip to content

Improve simulator stability, navigation, and CPU usage - #61

Open
oldgamer6753 wants to merge 1 commit into
p3p:masterfrom
oldgamer6753:fix/simulator-stability-navigation-cpu
Open

Improve simulator stability, navigation, and CPU usage#61
oldgamer6753 wants to merge 1 commit into
p3p:masterfrom
oldgamer6753:fix/simulator-stability-navigation-cpu

Conversation

@oldgamer6753

Copy link
Copy Markdown

Summary

This PR includes three small improvements to MarlinSimUI:

  • Fix loading of the external imgui.ini file to prevent crashes on subsequent simulator launches.
  • Increase mouse wheel zoom speed in the 3D visualization.
  • Reduce CPU usage caused by aggressive polling in RawSocketSerial.

Changes

  • resources.cpp

    • Replace reserve() with resize() before reading file data.
    • Explicitly null-terminate the buffer.
    • Construct std::string_view with the actual file size.
  • visualisation.cpp

    • Increase mouse wheel zoom step and remove frame-time dependency.
  • RawSocketSerial.h

    • Increase idle socket polling delay from 1 ns to 1 ms.

Testing

Tested on Windows 10 with Marlin Simulator built through PlatformIO.

Verified:

  • Repeated simulator launches with generated imgui.ini no longer crash;
  • Mouse wheel zoom is faster and easier to use;
  • On an Intel Core i5-6500 3.20 GHz, typical CPU usage dropped from about 59% to about 30%. Results may vary on other hardware;
  • Simulator UI and LCD interaction remain responsive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant