Skip to content

修复无法发送超级电容重置命令BUG#56

Merged
popchutty merged 1 commit into
mainfrom
fix/supercap-restart
Apr 17, 2026
Merged

修复无法发送超级电容重置命令BUG#56
popchutty merged 1 commit into
mainfrom
fix/supercap-restart

Conversation

@popchutty
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings April 17, 2026 20:03
@popchutty popchutty merged commit 57dfa60 into main Apr 17, 2026
3 checks passed
@popchutty popchutty deleted the fix/supercap-restart branch April 17, 2026 20:03
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

该 PR 修复“无法发送超级电容重置命令”的问题:将一次性重启指令从直接写入发送缓冲,改为通过挂起标志在下一次组帧时发送一次。

Changes:

  • 新增 m_pendingRestart 标志位用于缓存一次性重启请求
  • setSystemRestart() 改为仅置位挂起标志
  • getControlData() 在组帧时根据挂起标志写入 systemRestart 位并清除挂起标志

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
GSRL/Device/src/dvc_supercapacitor.cpp 通过挂起标志修复重启指令在组帧阶段被清零导致无法发送的问题
GSRL/Device/inc/dvc_supercapacitor.hpp 为一次性重启指令新增成员变量 m_pendingRestart

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +96 to +101
// 若标志置位则发送一次系统重启指令
TxData *tx = reinterpret_cast<TxData *>(m_txData);
tx->systemRestart = 0;
tx->systemRestart = m_pendingRestart ? 1 : 0;
m_pendingRestart = false;

return data;
return m_txData;
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

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

setSystemRestart() 的注释写的是“发送后自动清除重启标志”,但当前实现是:在 getControlData() 中把 systemRestart 置 1 后仅清除 m_pendingRestart,而 TxData::systemRestart 这个位会一直保持为 1,直到下一次调用 getControlData() 才会被写回 0。若上层在多次发送之间没有再次调用 getControlData()(复用上一次返回的 buffer),可能导致重启指令被重复发送。建议:要么更新注释/接口语义为“下一帧发送一次,下一次 getControlData() 会清除”,要么改成在构建待发帧时用临时buffer/发送接口封装,确保该位在单帧发送后立即清零。

Copilot uses AI. Check for mistakes.
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