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

Huawei grid charger usability fixes #1572

Merged
merged 3 commits into from
Jan 23, 2025

Conversation

schlimmchen
Copy link
Member

  • Fetching CAN messages (from the MCP2515) is very time critical. Attempt to miss less (hopefully none at all) messages.
  • Stop caching new values for too long. Restore the previous trigger to push the values up to higher software levels.
  • Send a request for data immediately after sending a parameter, allowing to update the PSU values in a timely manner.

we really need to be quick in retrieving CAN messages when the MCP2515
signals its interrupt. we therefore increase the hardware interface
task's priority, so it is even higher priority than the Async TCP task.
more importantly, we need to ask the scheduler to preempt a low-priority
task and schedule the hardware interface task immediately, so we can
retrieve the CAN messages in time.
the previous implementaton by MalteSchm relied that the 0x81 output
current value was always the last one to be received. afterwards the
data would be pushed upwards the stack. I did not like that, as I think
that the values can potentially arrive in arbitrary order, as they are
encoded with a type for a reason. in practice, that is probably not the
case.

waiting to push the collected values up the stack until a new request is
sent has a significant drawback: once the values arrive at higher
software levels, they are already <poll interval> seconds old.

for that reason, I decided to restore the previous logic, where the
output current value triggers the completion of collecting values.
however, as a fall-back, the cached values are also pushed in case there
are still some when we send a new request.
after sending new parameters, immediately send a new request to poll the
new parameters, allowing to update the web UI in particular.
@schlimmchen schlimmchen merged commit 587f8ca into development Jan 23, 2025
16 checks passed
@schlimmchen schlimmchen deleted the schlimmchen/fix/huawei-improvements branch January 23, 2025 15:46
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