Commit a8ec0bf
Fix HR PID race condition with training program speed changes
The HR controller was reading the current speed, calculating an adjustment,
then firing the change. If a training program changed speed in between these
steps, the HR controller would overwrite the new speed with a stale calculation.
Solution: Track when the training program changes speed via a timestamp in
homeform. Both HR PID modes (zone-based and min/max) now skip adjustments
for the configured delta period (typically 10 seconds) after a training
program speed change, allowing the body to respond to the new speed first.
Changes:
- Add lastTrainingProgramSpeedChange timestamp member to homeform
- Add onTrainingProgramSpeedChanged() slot to record speed change timestamps
- Connect training program changeSpeed signal to the new slot
- Guard both HR PID adjustment sections with recentSpeedChange check
- Skip adjustments if a training program speed change occurred within delta seconds
- Fix indentation to match project style (cpp and header files)1 parent 5227002 commit a8ec0bf
3 files changed
Lines changed: 35 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1590 | 1590 | | |
1591 | 1591 | | |
1592 | 1592 | | |
| 1593 | + | |
| 1594 | + | |
1593 | 1595 | | |
1594 | 1596 | | |
1595 | 1597 | | |
| |||
1647 | 1649 | | |
1648 | 1650 | | |
1649 | 1651 | | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
1650 | 1655 | | |
1651 | 1656 | | |
1652 | 1657 | | |
| |||
1738 | 1743 | | |
1739 | 1744 | | |
1740 | 1745 | | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
1741 | 1753 | | |
1742 | 1754 | | |
1743 | 1755 | | |
| |||
7300 | 7312 | | |
7301 | 7313 | | |
7302 | 7314 | | |
| 7315 | + | |
| 7316 | + | |
| 7317 | + | |
| 7318 | + | |
| 7319 | + | |
| 7320 | + | |
7303 | 7321 | | |
7304 | 7322 | | |
7305 | 7323 | | |
| |||
7411 | 7429 | | |
7412 | 7430 | | |
7413 | 7431 | | |
| 7432 | + | |
7414 | 7433 | | |
7415 | 7434 | | |
7416 | 7435 | | |
| |||
7468 | 7487 | | |
7469 | 7488 | | |
7470 | 7489 | | |
| 7490 | + | |
| 7491 | + | |
| 7492 | + | |
| 7493 | + | |
| 7494 | + | |
| 7495 | + | |
7471 | 7496 | | |
7472 | 7497 | | |
7473 | 7498 | | |
| |||
7589 | 7614 | | |
7590 | 7615 | | |
7591 | 7616 | | |
7592 | | - | |
7593 | | - | |
7594 | | - | |
7595 | | - | |
| 7617 | + | |
| 7618 | + | |
| 7619 | + | |
| 7620 | + | |
| 7621 | + | |
7596 | 7622 | | |
7597 | 7623 | | |
7598 | 7624 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
974 | 974 | | |
975 | 975 | | |
976 | 976 | | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
977 | 980 | | |
978 | 981 | | |
979 | 982 | | |
| |||
1089 | 1092 | | |
1090 | 1093 | | |
1091 | 1094 | | |
| 1095 | + | |
1092 | 1096 | | |
1093 | 1097 | | |
1094 | 1098 | | |
| |||
0 commit comments