Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utilities broken out of the fast rate PR #28240

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

andyp1per
Copy link
Collaborator

No description provided.

rate switch utility. This helps to compare different tunes in-flight to compare performance
--]]

---@diagnostic disable: param-type-mismatch
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is cheating. What is the error?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I just copied this from somewhere else!

-- shorten pname to fit with X_ prefix
local short_name = string.sub(name, math.max(1, 1 + string.len(name) - (16 - string.len(PARAM_BACKUP_TABLE_PREFIX))))
assert(param:add_param(PARAM_BACKUP_TABLE_KEY, idx, short_name, default_value), string.format('could not add param %s', short_name))
local p = bind_param(PARAM_BACKUP_TABLE_PREFIX .. short_name)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
local p = bind_param(PARAM_BACKUP_TABLE_PREFIX .. short_name)
local p = Parameter(PARAM_BACKUP_TABLE_PREFIX .. short_name)

I suspect this will fix the warning. You can remove the bind_param helper.

-- add a parameter and bind it to a variable
function bind_add_param(name, idx, default_value)
assert(param:add_param(PARAM_TABLE_KEY, idx, name, default_value), string.format('could not add param %s', name))
local p = bind_param(PARAM_TABLE_PREFIX .. name)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
local p = bind_param(PARAM_TABLE_PREFIX .. name)
local p = Parameter(PARAM_TABLE_PREFIX .. name)

-- when we fault we run the update function again after 1s, slowing it
-- down a bit so we don't flood the console with errors
--return protected_wrapper, 1000
return
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you just return here you might as well not bother with the protected_wrapper at all.

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.

2 participants