test enhanced_polling_nb_iter

This commit is contained in:
CrazyRedMachine 2023-09-03 18:10:11 +02:00
parent 5eacda584e
commit 98ba8de780
2 changed files with 13 additions and 6 deletions

View File

@ -44,6 +44,7 @@ struct popnhax_config {
uint8_t debounce;
bool enhanced_polling_stats;
int8_t enhanced_polling_priority;
uint32_t enhanced_polling_nb_iter;
uint8_t hispeed_auto;
uint16_t hispeed_default_bpm;
uint8_t survival_gauge;

View File

@ -166,6 +166,8 @@ PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, translation_de
"/popnhax/translation_debug")
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, enhanced_polling,
"/popnhax/enhanced_polling")
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_U32, struct popnhax_config, enhanced_polling_nb_iter,
"/popnhax/enhanced_polling_nb_iter")
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_U8, struct popnhax_config, debounce,
"/popnhax/debounce")
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, enhanced_polling_stats,
@ -2205,10 +2207,10 @@ int (*usbPadRead)(uint32_t*);
#pragma GCC push_options
#pragma GCC optimize ("O0")
static void __inline wait_a_little()
static void __inline wait_a_little(uint32_t nb_iter)
{
int j=0;
for (int i=0; i<450000; i++)
uint32_t j=0;
for (uint32_t i=0; i<nb_iter; i++)
{
j++;
}
@ -2253,10 +2255,14 @@ static unsigned int __stdcall enhanced_polling_stats_proc(void *ctx)
* (beware of SD cab hardware compatibility)
*/
wait_a_little();
curr_poll_time = timeGetTime();
prev_poll_time = curr_poll_time;
if (curr_poll_time == prev_poll_time)
{
wait_a_little(config.enhanced_polling_nb_iter);
curr_poll_time++;
}
prev_poll_time = curr_poll_time;
if (count == 0)
{
count_time = curr_poll_time;