bugfix: avoid NONE value after startup.

This commit is contained in:
Gatsby Van
2024-01-24 10:53:17 +08:00
parent 989b9495c6
commit 911360c0e8
+1 -1
View File
@@ -56,7 +56,7 @@ inline uint8_t GetWritable(PINGPONG ctrllor)
inline uint8_t GetReadable(PINGPONG ctrllor) inline uint8_t GetReadable(PINGPONG ctrllor)
{ {
if (ctrllor.wBusy == BUFF_NONE || ctrllor.wBusy != ctrllor.latest) if (ctrllor.wBusy == BUFF_NONE || ctrllor.wBusy != ctrllor.latest)
return ctrllor.latest; return ((ctrllor.latest == BUFF_NONE) ? BUFF_A : BUFF_B);
else else
return ((ctrllor.wBusy == BUFF_B) ? BUFF_A : BUFF_B); return ((ctrllor.wBusy == BUFF_B) ? BUFF_A : BUFF_B);
} }