|
66 | 66 | #define MAIN_LOOP_SLEEP_US 20 // Main loop sleep time in microseconds |
67 | 67 | constexpr auto kPinmameTrackedStatePollInterval = std::chrono::milliseconds(500); |
68 | 68 | constexpr uint32_t kDefaultSwitchRefreshIdleMs = 15000; |
| 69 | +constexpr uint32_t kDefaultOutputFrameIntervalMs = 4; |
69 | 70 | constexpr uint32_t kDefaultBallSearchDelayMs = 15000; |
70 | 71 | constexpr uint32_t kDefaultBallSearchRoundDelayMs = 5000; |
71 | 72 | constexpr uint32_t kBallSearchCoilPulseMs = 200; |
@@ -2254,6 +2255,10 @@ static struct cag_option options[] = { |
2254 | 2255 | .access_name = "switch-refresh-idle-ms", |
2255 | 2256 | .value_name = "VALUE", |
2256 | 2257 | .description = "Force a full switch refresh after this many ms without non-button switch updates"}, |
| 2258 | + {.identifier = '%', |
| 2259 | + .access_name = "output-frame-interval-ms", |
| 2260 | + .value_name = "VALUE", |
| 2261 | + .description = "Runtime output frame interval in milliseconds; lower values increase switch poll cadence"}, |
2257 | 2262 | {.identifier = 'B', |
2258 | 2263 | .access_name = "ball-search", |
2259 | 2264 | .value_name = NULL, |
@@ -2716,6 +2721,8 @@ int main(int argc, char** argv) |
2716 | 2721 | uint32_t opt_switch_reply_delay_us = 0; |
2717 | 2722 | const char* opt_switch_refresh_idle_ms_arg = NULL; |
2718 | 2723 | uint32_t opt_switch_refresh_idle_ms = kDefaultSwitchRefreshIdleMs; |
| 2724 | + const char* opt_output_frame_interval_ms_arg = NULL; |
| 2725 | + uint32_t opt_output_frame_interval_ms = kDefaultOutputFrameIntervalMs; |
2719 | 2726 | bool opt_ball_search = false; |
2720 | 2727 | const char* opt_ball_search_delay_ms_arg = NULL; |
2721 | 2728 | uint32_t opt_ball_search_delay_ms = kDefaultBallSearchDelayMs; |
@@ -2879,6 +2886,8 @@ int main(int argc, char** argv) |
2879 | 2886 | opt_switch_reply_delay_us_arg = DuplicateOptionalIniString(value); |
2880 | 2887 | else if (key == "SwitchRefreshIdleMs") |
2881 | 2888 | opt_switch_refresh_idle_ms_arg = DuplicateOptionalIniString(value); |
| 2889 | + else if (key == "OutputFrameIntervalMs") |
| 2890 | + opt_output_frame_interval_ms_arg = DuplicateOptionalIniString(value); |
2882 | 2891 | else if (key == "BallSearch") |
2883 | 2892 | opt_ball_search = ParseIniBool(value); |
2884 | 2893 | else if (key == "BallSearchDelayMs") |
@@ -3072,6 +3081,9 @@ int main(int argc, char** argv) |
3072 | 3081 | case 'g': |
3073 | 3082 | opt_switch_refresh_idle_ms_arg = cag_option_get_value(&cag_context); |
3074 | 3083 | break; |
| 3084 | + case '%': |
| 3085 | + opt_output_frame_interval_ms_arg = cag_option_get_value(&cag_context); |
| 3086 | + break; |
3075 | 3087 | case 'B': |
3076 | 3088 | opt_ball_search = true; |
3077 | 3089 | break; |
@@ -3223,6 +3235,17 @@ int main(int argc, char** argv) |
3223 | 3235 | fprintf(stderr, "--switch-refresh-idle-ms must be greater than 0 because switch re-reading is always active\n"); |
3224 | 3236 | return 1; |
3225 | 3237 | } |
| 3238 | + if (opt_output_frame_interval_ms_arg && |
| 3239 | + !ParseUint32Strict(opt_output_frame_interval_ms_arg, &opt_output_frame_interval_ms)) |
| 3240 | + { |
| 3241 | + fprintf(stderr, "Invalid value for --output-frame-interval-ms: %s\n", opt_output_frame_interval_ms_arg); |
| 3242 | + return 1; |
| 3243 | + } |
| 3244 | + if (opt_output_frame_interval_ms == 0) |
| 3245 | + { |
| 3246 | + fprintf(stderr, "--output-frame-interval-ms must be greater than 0\n"); |
| 3247 | + return 1; |
| 3248 | + } |
3226 | 3249 | if (opt_ball_search_delay_ms_arg && !ParseUint32Strict(opt_ball_search_delay_ms_arg, &opt_ball_search_delay_ms)) |
3227 | 3250 | { |
3228 | 3251 | fprintf(stderr, "Invalid value for --ball-search-delay-ms: %s\n", opt_ball_search_delay_ms_arg); |
@@ -3464,6 +3487,7 @@ int main(int argc, char** argv) |
3464 | 3487 | ppuc->SetCoilHoldFrames(opt_coil_hold_frames); |
3465 | 3488 | ppuc->SetSwitchReplyDelayUs(opt_switch_reply_delay_us); |
3466 | 3489 | ppuc->SetSwitchRefreshIdleMs(opt_switch_refresh_idle_ms); |
| 3490 | + ppuc->SetOutputFrameIntervalMs(opt_output_frame_interval_ms); |
3467 | 3491 | ppuc->SetDisableFastFlipForTests(opt_switch_test || opt_coil_test || opt_lamp_test || opt_gi_test || |
3468 | 3492 | opt_flasher_test); |
3469 | 3493 |
|
|
0 commit comments