Refactor canned message setting

This commit is contained in:
Allen Hill
2026-05-05 11:32:57 -07:00
parent 9d044cd1f7
commit 28db9fb6b5
+15 -18
View File
@@ -26,6 +26,7 @@
#include <avr/xmega.h> #include <avr/xmega.h>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include "avclandrv.h" #include "avclandrv.h"
#include "com232.h" #include "com232.h"
@@ -75,9 +76,7 @@ int main() {
RS232_RxCharBegin = RS232_RxCharEnd = 0; // reset buffer RS232_RxCharBegin = RS232_RxCharEnd = 0; // reset buffer
sei(); sei();
switch (readkey) { switch (readkey) {
case '?': case '?': print_help(); break;
print_help();
break;
case 'v': case 'v':
verbose ^= 1; verbose ^= 1;
RS232_Print("Verbose: "); RS232_Print("Verbose: ");
@@ -141,12 +140,12 @@ int main() {
break; break;
case 'b': case 'b':
case 'B': // Beep case 'B': // Beep
data_tmp[0] = 0x00; {
data_tmp[1] = dev_CD_CHANGER; const uint8_t beep[] = {0x00, dev_CD_CHANGER, dev_BEEP_SPEAKERS, 0x60,
data_tmp[2] = dev_BEEP_SPEAKERS; 0x01};
data_tmp[3] = 0x60; memcpy(data_tmp, beep, sizeof(beep));
data_tmp[4] = 0x01; msg.length = sizeof(beep);
msg.length = 5; }
msg.broadcast = UNICAST; msg.broadcast = UNICAST;
msg.controller_addr = DEVICE_ADDR; msg.controller_addr = DEVICE_ADDR;
msg.peripheral_addr = HU_ADDR; msg.peripheral_addr = HU_ADDR;
@@ -154,12 +153,12 @@ int main() {
break; break;
case 'p': case 'p':
CD_Mode = stPlay; CD_Mode = stPlay;
data_tmp[0] = 0x00; {
data_tmp[1] = dev_COMM_CTRL; const uint8_t play[] = {0x00, dev_COMM_CTRL, dev_COMM_v1,
data_tmp[2] = dev_COMM_v1; Insertion, dev_CD_CHANGER, 0x01};
data_tmp[3] = Insertion; memcpy(data_tmp, play, sizeof(play));
data_tmp[4] = dev_CD_CHANGER; msg.length = sizeof(play);
msg.length = 5; }
msg.broadcast = UNICAST; msg.broadcast = UNICAST;
msg.controller_addr = DEVICE_ADDR; msg.controller_addr = DEVICE_ADDR;
msg.peripheral_addr = HU_ADDR; msg.peripheral_addr = HU_ADDR;
@@ -167,9 +166,7 @@ int main() {
break; break;
#ifdef SOFTWARE_DEBUG #ifdef SOFTWARE_DEBUG
case 'M': case 'M': AVCLan_Measure(); break;
AVCLan_Measure();
break;
#endif #endif
case 0x10: // Signals binary sequence incoming case 0x10: // Signals binary sequence incoming