Fix bad function call

This commit is contained in:
Allen Hill
2026-05-10 18:55:23 -07:00
parent a0071ea862
commit 1e715d1daa
2 changed files with 10 additions and 10 deletions
+1 -2
View File
@@ -58,8 +58,7 @@ void RS232_Init(void) {
ISR(USART0_RXC_vect) { ISR(USART0_RXC_vect) {
// Store received character to the End of Buffer // Store received character to the End of Buffer
RS232_RxCharBuffer[RS232_RxCharEnd] = USART0_RXDATAL; RS232_RxCharBuffer[RS232_RxCharEnd++] = USART0_RXDATAL;
RS232_RxCharEnd++;
} }
void RS232_SendByte(uint8_t Data) { void RS232_SendByte(uint8_t Data) {
+8 -7
View File
@@ -66,7 +66,10 @@ static uint8_t return_resp(RFrame_t *resp) {
} }
static uint8_t push_or_return_resp(RFrame_t *resp) { static uint8_t push_or_return_resp(RFrame_t *resp) {
uint8_t err = pushQueue(&outgoing, resp) && return_resp(resp); uint8_t err = pushQueue(&outgoing, resp);
if (err)
return return_resp(resp);
else
return err; return err;
} }
@@ -108,6 +111,7 @@ int main() {
constructQueue(&cache, frames, sizeof(AVCLAN_frame_t), CACHE_SIZE, 1); constructQueue(&cache, frames, sizeof(AVCLAN_frame_t), CACHE_SIZE, 1);
constructEmptyQueue(&incoming, sizeof(AVCLAN_frame_t), CACHE_SIZE); constructEmptyQueue(&incoming, sizeof(AVCLAN_frame_t), CACHE_SIZE);
constructQueue(&rcache, responses, sizeof(RFrame_t), CACHE_SIZE, 1); constructQueue(&rcache, responses, sizeof(RFrame_t), CACHE_SIZE, 1);
constructEmptyQueue(&outgoing, sizeof(RFrame_t), CACHE_SIZE); constructEmptyQueue(&outgoing, sizeof(RFrame_t), CACHE_SIZE);
@@ -138,6 +142,7 @@ int main() {
msg = (AVCLAN_frame_t *)popQueue( msg = (AVCLAN_frame_t *)popQueue(
&incoming); // prior !isempty(incoming) guarantees success &incoming); // prior !isempty(incoming) guarantees success
response_t respond = AVCLAN_handleframe(msg, out); response_t respond = AVCLAN_handleframe(msg, out);
pushQueue(&cache, msg);
if (respond) { if (respond) {
resp = (RFrame_t *)popQueue(&rcache); resp = (RFrame_t *)popQueue(&rcache);
@@ -148,24 +153,20 @@ int main() {
pushQueue(&cache, out); pushQueue(&cache, out);
} else // no response needed; return to circulation } else // no response needed; return to circulation
pushQueue(&cache, out); pushQueue(&cache, out);
pushQueue(&cache, msg);
} else if (!isEmpty(&outgoing)) { } else if (!isEmpty(&outgoing)) {
resp = (RFrame_t *)popQueue( resp = (RFrame_t *)popQueue(
&outgoing); // prior !isempty(outgoing) guarantees success &outgoing); // prior !isempty(outgoing) guarantees success
out = resp->frame; out = resp->frame;
err = AVCLAN_sendframe(out); err = AVCLAN_sendframe(out);
if (err) { if (err) {
RS232_Print("!! Failed to send frame; error code ");
RS232_PrintHex(err);
RS232_Print(" !!\n");
return_resp(resp); return_resp(resp);
} else { } else {
// Re-use successful resp for sequence // Re-use successful resp for sequence
switch (resp->r) { switch (resp->r) {
case r_TrackChange: AVCLAN_setTime(0x00, 0x00); // fallthrough case r_TrackChange: AVCLAN_setTime(0x00, 0x00); // fallthrough
case r_NormalizeState: case r_NormalizeState:
AVCLAN_normalizeState(out); AVCLAN_normalizeState();
AVCLAN_generateStatus(out);
resp->r = r_Handled; resp->r = r_Handled;
push_or_return_resp(resp); push_or_return_resp(resp);
break; break;