1
0
mirror of https://github.com/halleysfifthinc/Toyota-AVC-LAN synced 2025-06-07 16:06:12 +00:00

Indent case labels

This commit is contained in:
Allen Hill 2023-08-19 21:41:45 -04:00
parent c07083423f
commit 48b20a9c5c
3 changed files with 161 additions and 160 deletions

View File

@ -3,4 +3,5 @@ BasedOnStyle: LLVM
UseCRLF: false UseCRLF: false
BreakBeforeBraces: Attach BreakBeforeBraces: Attach
AllowShortBlocksOnASingleLine: Empty AllowShortBlocksOnASingleLine: Empty
IndentCaseLabels: true
... ...

View File

@ -759,69 +759,69 @@ byte AVCLan_SendAnswer() {
byte r = 0; byte r = 0;
switch (answerReq) { switch (answerReq) {
case cmStatus1: case cmStatus1:
r = AVCLan_SendAnswerFrame((byte *)CMD_STATUS1); r = AVCLan_SendAnswerFrame((byte *)CMD_STATUS1);
break; break;
case cmStatus2: case cmStatus2:
r = AVCLan_SendAnswerFrame((byte *)CMD_STATUS2); r = AVCLan_SendAnswerFrame((byte *)CMD_STATUS2);
break; break;
case cmStatus3: case cmStatus3:
r = AVCLan_SendAnswerFrame((byte *)CMD_STATUS3); r = AVCLan_SendAnswerFrame((byte *)CMD_STATUS3);
break; break;
case cmStatus4: case cmStatus4:
r = AVCLan_SendAnswerFrame((byte *)CMD_STATUS4); r = AVCLan_SendAnswerFrame((byte *)CMD_STATUS4);
break; break;
case cmRegister: case cmRegister:
r = AVCLan_SendAnswerFrame((byte *)CMD_REGISTER); r = AVCLan_SendAnswerFrame((byte *)CMD_REGISTER);
break; break;
case cmInit: // RS232_Print("INIT\n"); case cmInit: // RS232_Print("INIT\n");
r = AVCLan_SendInitCommands(); r = AVCLan_SendInitCommands();
break; break;
case cmCheck: case cmCheck:
r = AVCLan_SendAnswerFrame((byte *)CMD_CHECK); r = AVCLan_SendAnswerFrame((byte *)CMD_CHECK);
check_timeout = 0; check_timeout = 0;
CMD_CHECK[6]++; CMD_CHECK[6]++;
RS232_Print("AVCCHK\n"); RS232_Print("AVCCHK\n");
break; break;
case cmPlayReq1: case cmPlayReq1:
playMode = 0; playMode = 0;
r = AVCLan_SendAnswerFrame((byte *)CMD_PLAY_OK1); r = AVCLan_SendAnswerFrame((byte *)CMD_PLAY_OK1);
break; break;
case cmPlayReq2: case cmPlayReq2:
case cmPlayReq3: case cmPlayReq3:
playMode = 0; playMode = 0;
r = AVCLan_SendAnswerFrame((byte *)CMD_PLAY_OK2); r = AVCLan_SendAnswerFrame((byte *)CMD_PLAY_OK2);
if (!r) if (!r)
r = AVCLan_SendAnswerFrame((byte *)CMD_PLAY_OK3); r = AVCLan_SendAnswerFrame((byte *)CMD_PLAY_OK3);
CD_Mode = stPlay; CD_Mode = stPlay;
break; break;
case cmPlayIt: case cmPlayIt:
playMode = 1; playMode = 1;
RS232_Print("PLAY\n"); RS232_Print("PLAY\n");
CMD_PLAY_OK4[7] = cd_Disc; CMD_PLAY_OK4[7] = cd_Disc;
CMD_PLAY_OK4[8] = cd_Track; CMD_PLAY_OK4[8] = cd_Track;
CMD_PLAY_OK4[9] = cd_Time_Min; CMD_PLAY_OK4[9] = cd_Time_Min;
CMD_PLAY_OK4[10] = cd_Time_Sec; CMD_PLAY_OK4[10] = cd_Time_Sec;
r = AVCLan_SendAnswerFrame((byte *)CMD_PLAY_OK4); r = AVCLan_SendAnswerFrame((byte *)CMD_PLAY_OK4);
if (!r) if (!r)
AVCLan_Send_Status(); AVCLan_Send_Status();
CD_Mode = stPlay; CD_Mode = stPlay;
break; break;
case cmStopReq: case cmStopReq:
case cmStopReq2: case cmStopReq2:
CD_Mode = stStop; CD_Mode = stStop;
playMode = 0; playMode = 0;
r = AVCLan_SendAnswerFrame((byte *)CMD_STOP1); r = AVCLan_SendAnswerFrame((byte *)CMD_STOP1);
CMD_STOP2[7] = cd_Disc; CMD_STOP2[7] = cd_Disc;
CMD_STOP2[8] = cd_Track; CMD_STOP2[8] = cd_Track;
CMD_STOP2[9] = cd_Time_Min; CMD_STOP2[9] = cd_Time_Min;
CMD_STOP2[10] = cd_Time_Sec; CMD_STOP2[10] = cd_Time_Sec;
r = AVCLan_SendAnswerFrame((byte *)CMD_STOP2); r = AVCLan_SendAnswerFrame((byte *)CMD_STOP2);
break; break;
case cmBeep: case cmBeep:
AVCLan_SendAnswerFrame((byte *)CMD_BEEP); AVCLan_SendAnswerFrame((byte *)CMD_BEEP);
break; break;
} }
answerReq = cmNull; answerReq = cmNull;

196
sniffer.c
View File

@ -71,10 +71,10 @@ int main() {
// HandleEvent // HandleEvent
switch (Event) { switch (Event) {
case EV_STATUS: case EV_STATUS:
Event &= ~EV_STATUS; Event &= ~EV_STATUS;
AVCLan_Send_Status(); AVCLan_Send_Status();
break; break;
} }
// Key handler // Key handler
@ -87,109 +87,109 @@ int main() {
RS232_RxCharBegin = RS232_RxCharEnd = 0; // reset Buffer RS232_RxCharBegin = RS232_RxCharEnd = 0; // reset Buffer
sbi(USART0.CTRLA, USART_RXCIE_bp); // enable RX complete interrupt sbi(USART0.CTRLA, USART_RXCIE_bp); // enable RX complete interrupt
switch (readkey) { switch (readkey) {
case 'S': case 'S':
showLog = 0; showLog = 0;
RS232_Print("READ SEQUENCE > \n"); RS232_Print("READ SEQUENCE > \n");
readSeq = 1; readSeq = 1;
s_len = 0; s_len = 0;
s_dig = 0; s_dig = 0;
s_c[0] = s_c[1] = 0; s_c[0] = s_c[1] = 0;
break; break;
case 'W': case 'W':
showLog = 1; showLog = 1;
readSeq = 0; readSeq = 0;
AVCLan_SendMyData(data_tmp, s_len); AVCLan_SendMyData(data_tmp, s_len);
break; break;
case 'Q': case 'Q':
showLog = 1; showLog = 1;
readSeq = 0; readSeq = 0;
AVCLan_SendMyDataBroadcast(data_tmp, s_len); AVCLan_SendMyDataBroadcast(data_tmp, s_len);
break; break;
case 'R': case 'R':
RS232_Print("REGIST:\n"); RS232_Print("REGIST:\n");
AVCLan_Command(cmRegister); AVCLan_Command(cmRegister);
TCB1.CNT = 0; TCB1.CNT = 0;
while (TCB1.CNT < 540) {} while (TCB1.CNT < 540) {}
CHECK_AVC_LINE; CHECK_AVC_LINE;
break; break;
case 'r': case 'r':
AVCLan_Register(); AVCLan_Register();
break; break;
case 'l': case 'l':
RS232_Print("Log OFF\n"); RS232_Print("Log OFF\n");
showLog = 0; showLog = 0;
break; break;
case 'L': case 'L':
RS232_Print("Log ON\n"); RS232_Print("Log ON\n");
showLog = 1; showLog = 1;
break; break;
case 'k': case 'k':
RS232_Print("str OFF\n"); RS232_Print("str OFF\n");
showLog2 = 0; showLog2 = 0;
break; break;
case 'K': case 'K':
RS232_Print("str ON\n"); RS232_Print("str ON\n");
showLog2 = 1; showLog2 = 1;
break; break;
case 'B': case 'B':
data_tmp[0] = 0x00; data_tmp[0] = 0x00;
data_tmp[1] = 0x5E; data_tmp[1] = 0x5E;
data_tmp[2] = 0x29; data_tmp[2] = 0x29;
data_tmp[3] = 0x60; data_tmp[3] = 0x60;
data_tmp[4] = 0x01; data_tmp[4] = 0x01;
s_len = 5; s_len = 5;
AVCLan_SendMyData(data_tmp, s_len); AVCLan_SendMyData(data_tmp, s_len);
break; break;
#ifdef HARDWARE_DEBUG #ifdef HARDWARE_DEBUG
case '1': case '1':
SetHighLow(); SetHighLow();
break; break;
case 'E': case 'E':
if (INPUT_IS_SET) { if (INPUT_IS_SET) {
RS232_Print("Set/High/1\n"); RS232_Print("Set/High/1\n");
} else if (INPUT_IS_CLEAR) { } else if (INPUT_IS_CLEAR) {
RS232_Print("Unset/Low/0\n"); RS232_Print("Unset/Low/0\n");
} else { } else {
RS232_Print("WTF?\n"); RS232_Print("WTF?\n");
} }
break; break;
#endif #endif
#ifdef SOFTWARE_DEBUG #ifdef SOFTWARE_DEBUG
case 'M': case 'M':
AVCLan_Measure(); AVCLan_Measure();
break; break;
#endif #endif
default: default:
if (readSeq == 1) { if (readSeq == 1) {
s_c[s_dig] = readkey; s_c[s_dig] = readkey;
s_dig++; s_dig++;
if (s_dig == 2) { if (s_dig == 2) {
if (s_c[0] < ':') if (s_c[0] < ':')
s_c[0] -= 48; s_c[0] -= 48;
else else
s_c[0] -= 55; s_c[0] -= 55;
data_tmp[s_len] = 16 * s_c[0]; data_tmp[s_len] = 16 * s_c[0];
if (s_c[1] < ':') if (s_c[1] < ':')
s_c[1] -= 48; s_c[1] -= 48;
else else
s_c[1] -= 55; s_c[1] -= 55;
data_tmp[s_len] += s_c[1]; data_tmp[s_len] += s_c[1];
s_len++; s_len++;
s_dig = 0; s_dig = 0;
s_c[0] = s_c[1] = 0; s_c[0] = s_c[1] = 0;
} }
if (showLog2) { if (showLog2) {
RS232_Print("CURRENT SEQUENCE > "); RS232_Print("CURRENT SEQUENCE > ");
for (i = 0; i < s_len; i++) { for (i = 0; i < s_len; i++) {
RS232_PrintHex8(data_tmp[i]); RS232_PrintHex8(data_tmp[i]);
RS232_SendByte(' '); RS232_SendByte(' ');
}
RS232_Print("\n");
} }
RS232_Print("\n");
} }
}
} // switch (readkey) } // switch (readkey)
} // if (RS232_RxCharEnd) } // if (RS232_RxCharEnd)
} }