fix EEPROM

This commit is contained in:
wu58430 2023-12-06 21:53:43 +08:00
parent 79e40d98b7
commit 439f514ed3
9 changed files with 209 additions and 178 deletions

View file

@ -20,7 +20,7 @@
</configurations> </configurations>
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="cea36e80-e289-4d69-9030-7186d540ac0e" name="更改" comment="MDC RX" /> <list default="true" id="cea36e80-e289-4d69-9030-7186d540ac0e" name="更改" comment="106 MDC crc fix" />
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@ -127,132 +127,7 @@
<workItem from="1701430185864" duration="10115000" /> <workItem from="1701430185864" duration="10115000" />
<workItem from="1701559895523" duration="22519000" /> <workItem from="1701559895523" duration="22519000" />
<workItem from="1701678199532" duration="14440000" /> <workItem from="1701678199532" duration="14440000" />
</task> <workItem from="1701736592511" duration="24083000" />
<task id="LOCAL-00001" summary="bug fix">
<created>1701136012311</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1701136012311</updated>
</task>
<task id="LOCAL-00002" summary="bug fix">
<created>1701136095519</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1701136095519</updated>
</task>
<task id="LOCAL-00003" summary="bug fix">
<created>1701136455006</created>
<option name="number" value="00003" />
<option name="presentableId" value="LOCAL-00003" />
<option name="project" value="LOCAL" />
<updated>1701136455006</updated>
</task>
<task id="LOCAL-00004" summary="payment">
<created>1701136490007</created>
<option name="number" value="00004" />
<option name="presentableId" value="LOCAL-00004" />
<option name="project" value="LOCAL" />
<updated>1701136490007</updated>
</task>
<task id="LOCAL-00005" summary="1129 190 update">
<created>1701241566748</created>
<option name="number" value="00005" />
<option name="presentableId" value="LOCAL-00005" />
<option name="project" value="LOCAL" />
<updated>1701241566748</updated>
</task>
<task id="LOCAL-00006" summary="1129 190 update">
<created>1701242206464</created>
<option name="number" value="00006" />
<option name="presentableId" value="LOCAL-00006" />
<option name="project" value="LOCAL" />
<updated>1701242206464</updated>
</task>
<task id="LOCAL-00007" summary="lite create">
<created>1701276006594</created>
<option name="number" value="00007" />
<option name="presentableId" value="LOCAL-00007" />
<option name="project" value="LOCAL" />
<updated>1701276006594</updated>
</task>
<task id="LOCAL-00008" summary="lite aim">
<created>1701312923492</created>
<option name="number" value="00008" />
<option name="presentableId" value="LOCAL-00008" />
<option name="project" value="LOCAL" />
<updated>1701312923492</updated>
</task>
<task id="LOCAL-00009" summary="lite aim">
<created>1701313038755</created>
<option name="number" value="00009" />
<option name="presentableId" value="LOCAL-00009" />
<option name="project" value="LOCAL" />
<updated>1701313038755</updated>
</task>
<task id="LOCAL-00010" summary="create">
<created>1701326536194</created>
<option name="number" value="00010" />
<option name="presentableId" value="LOCAL-00010" />
<option name="project" value="LOCAL" />
<updated>1701326536194</updated>
</task>
<task id="LOCAL-00011" summary="create">
<created>1701326555477</created>
<option name="number" value="00011" />
<option name="presentableId" value="LOCAL-00011" />
<option name="project" value="LOCAL" />
<updated>1701326555477</updated>
</task>
<task id="LOCAL-00012" summary="create">
<created>1701326799477</created>
<option name="number" value="00012" />
<option name="presentableId" value="LOCAL-00012" />
<option name="project" value="LOCAL" />
<updated>1701326799477</updated>
</task>
<task id="LOCAL-00013" summary="create">
<created>1701326908353</created>
<option name="number" value="00013" />
<option name="presentableId" value="LOCAL-00013" />
<option name="project" value="LOCAL" />
<updated>1701326908353</updated>
</task>
<task id="LOCAL-00014" summary="create">
<created>1701326945551</created>
<option name="number" value="00014" />
<option name="presentableId" value="LOCAL-00014" />
<option name="project" value="LOCAL" />
<updated>1701326945551</updated>
</task>
<task id="LOCAL-00015" summary="rebuild chinese">
<created>1701353957333</created>
<option name="number" value="00015" />
<option name="presentableId" value="LOCAL-00015" />
<option name="project" value="LOCAL" />
<updated>1701353957333</updated>
</task>
<task id="LOCAL-00016" summary="fix bug">
<created>1701432443458</created>
<option name="number" value="00016" />
<option name="presentableId" value="LOCAL-00016" />
<option name="project" value="LOCAL" />
<updated>1701432443458</updated>
</task>
<task id="LOCAL-00017" summary="fix bug">
<created>1701432770200</created>
<option name="number" value="00017" />
<option name="presentableId" value="LOCAL-00017" />
<option name="project" value="LOCAL" />
<updated>1701432770200</updated>
</task>
<task id="LOCAL-00018" summary="掃描下翻譯">
<created>1701439333297</created>
<option name="number" value="00018" />
<option name="presentableId" value="LOCAL-00018" />
<option name="project" value="LOCAL" />
<updated>1701439333297</updated>
</task> </task>
<task id="LOCAL-00019" summary="fix https://github.com/losehu/uv-k5-firmware-chinese/issues/4"> <task id="LOCAL-00019" summary="fix https://github.com/losehu/uv-k5-firmware-chinese/issues/4">
<created>1701484068802</created> <created>1701484068802</created>
@ -464,7 +339,140 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1701693594928</updated> <updated>1701693594928</updated>
</task> </task>
<option name="localTasksCounter" value="49" /> <task id="LOCAL-00049" summary="写频">
<created>1701736695809</created>
<option name="number" value="00049" />
<option name="presentableId" value="LOCAL-00049" />
<option name="project" value="LOCAL" />
<updated>1701736695809</updated>
</task>
<task id="LOCAL-00050" summary="写频">
<created>1701737194492</created>
<option name="number" value="00050" />
<option name="presentableId" value="LOCAL-00050" />
<option name="project" value="LOCAL" />
<updated>1701737194493</updated>
</task>
<task id="LOCAL-00051" summary="写频">
<created>1701737616363</created>
<option name="number" value="00051" />
<option name="presentableId" value="LOCAL-00051" />
<option name="project" value="LOCAL" />
<updated>1701737616364</updated>
</task>
<task id="LOCAL-00052" summary="写频">
<created>1701738044160</created>
<option name="number" value="00052" />
<option name="presentableId" value="LOCAL-00052" />
<option name="project" value="LOCAL" />
<updated>1701738044160</updated>
</task>
<task id="LOCAL-00053" summary="写频">
<created>1701738066407</created>
<option name="number" value="00053" />
<option name="presentableId" value="LOCAL-00053" />
<option name="project" value="LOCAL" />
<updated>1701738066407</updated>
</task>
<task id="LOCAL-00054" summary="写频">
<created>1701738074321</created>
<option name="number" value="00054" />
<option name="presentableId" value="LOCAL-00054" />
<option name="project" value="LOCAL" />
<updated>1701738074322</updated>
</task>
<task id="LOCAL-00055" summary="写频">
<created>1701738086757</created>
<option name="number" value="00055" />
<option name="presentableId" value="LOCAL-00055" />
<option name="project" value="LOCAL" />
<updated>1701738086757</updated>
</task>
<task id="LOCAL-00056" summary="写频">
<created>1701738213205</created>
<option name="number" value="00056" />
<option name="presentableId" value="LOCAL-00056" />
<option name="project" value="LOCAL" />
<updated>1701738213205</updated>
</task>
<task id="LOCAL-00057" summary="写频">
<created>1701738485690</created>
<option name="number" value="00057" />
<option name="presentableId" value="LOCAL-00057" />
<option name="project" value="LOCAL" />
<updated>1701738485690</updated>
</task>
<task id="LOCAL-00058" summary="写频">
<created>1701738979545</created>
<option name="number" value="00058" />
<option name="presentableId" value="LOCAL-00058" />
<option name="project" value="LOCAL" />
<updated>1701738979545</updated>
</task>
<task id="LOCAL-00059" summary="写频">
<created>1701739409050</created>
<option name="number" value="00059" />
<option name="presentableId" value="LOCAL-00059" />
<option name="project" value="LOCAL" />
<updated>1701739409050</updated>
</task>
<task id="LOCAL-00060" summary="写频">
<created>1701739895017</created>
<option name="number" value="00060" />
<option name="presentableId" value="LOCAL-00060" />
<option name="project" value="LOCAL" />
<updated>1701739895017</updated>
</task>
<task id="LOCAL-00061" summary="写频">
<created>1701740303236</created>
<option name="number" value="00061" />
<option name="presentableId" value="LOCAL-00061" />
<option name="project" value="LOCAL" />
<updated>1701740303236</updated>
</task>
<task id="LOCAL-00062" summary="写频">
<created>1701740447231</created>
<option name="number" value="00062" />
<option name="presentableId" value="LOCAL-00062" />
<option name="project" value="LOCAL" />
<updated>1701740447231</updated>
</task>
<task id="LOCAL-00063" summary="写频">
<created>1701740770876</created>
<option name="number" value="00063" />
<option name="presentableId" value="LOCAL-00063" />
<option name="project" value="LOCAL" />
<updated>1701740770876</updated>
</task>
<task id="LOCAL-00064" summary="写频">
<created>1701755444295</created>
<option name="number" value="00064" />
<option name="presentableId" value="LOCAL-00064" />
<option name="project" value="LOCAL" />
<updated>1701755444295</updated>
</task>
<task id="LOCAL-00065" summary="am-fix">
<created>1701769945196</created>
<option name="number" value="00065" />
<option name="presentableId" value="LOCAL-00065" />
<option name="project" value="LOCAL" />
<updated>1701769945196</updated>
</task>
<task id="LOCAL-00066" summary="mdc side beep">
<created>1701775483012</created>
<option name="number" value="00066" />
<option name="presentableId" value="LOCAL-00066" />
<option name="project" value="LOCAL" />
<updated>1701775483012</updated>
</task>
<task id="LOCAL-00067" summary="106 MDC crc fix">
<created>1701778784894</created>
<option name="number" value="00067" />
<option name="presentableId" value="LOCAL-00067" />
<option name="project" value="LOCAL" />
<updated>1701778784894</updated>
</task>
<option name="localTasksCounter" value="68" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
@ -504,6 +512,10 @@
<MESSAGE value="reduce flash" /> <MESSAGE value="reduce flash" />
<MESSAGE value="rebuild chinese" /> <MESSAGE value="rebuild chinese" />
<MESSAGE value="MDC RX" /> <MESSAGE value="MDC RX" />
<option name="LAST_COMMIT_MESSAGE" value="MDC RX" /> <MESSAGE value="写频" />
<MESSAGE value="am-fix" />
<MESSAGE value="mdc side beep" />
<MESSAGE value="106 MDC crc fix" />
<option name="LAST_COMMIT_MESSAGE" value="106 MDC crc fix" />
</component> </component>
</project> </project>

View file

@ -45,7 +45,7 @@ ENABLE_BYP_RAW_DEMODULATORS := 0
ENABLE_BLMIN_TMP_OFF := 0 ENABLE_BLMIN_TMP_OFF := 0
ENABLE_SCAN_RANGES := 1 ENABLE_SCAN_RANGES := 1
ENABLE_MDC1200 := 1 ENABLE_MDC1200 := 1
ENABLE_MDC1200_SHOW_OP_ARG := 0 ENABLE_MDC1200_SHOW_OP_ARG := 1
ENABLE_MDC1200_SIDE_BEEP := 0 ENABLE_MDC1200_SIDE_BEEP := 0
# ---- DEBUGGING ---- # ---- DEBUGGING ----
ENABLE_AM_FIX_SHOW_DATA := 0 ENABLE_AM_FIX_SHOW_DATA := 0

View file

@ -13,7 +13,7 @@ const uint8_t mdc1200_sync[5] = {0x07, 0x09, 0x2a, 0x44, 0x6f};
uint8_t mdc1200_sync_suc_xor[sizeof(mdc1200_sync)]; uint8_t mdc1200_sync_suc_xor[sizeof(mdc1200_sync)];
#if 0 #if 1
uint16_t compute_crc(const void *data, const unsigned int data_len) uint16_t compute_crc(const void *data, const unsigned int data_len)
{ // let the CPU's hardware do some work :) { // let the CPU's hardware do some work :)
@ -471,7 +471,8 @@ uint8_t mdc1200_rx_ready_tick_500ms;
void MDC1200_process_rx(const uint16_t interrupt_bits) void MDC1200_process_rx(const uint16_t interrupt_bits)
{ {
char b[2]="R0";
UART_Send((uint8_t *)&b,2);
const uint16_t rx_sync_flags = BK4819_ReadRegister(0x0B); const uint16_t rx_sync_flags = BK4819_ReadRegister(0x0B);
const uint16_t fsk_reg59 = BK4819_ReadRegister(0x59) & ~((1u << 15) | (1u << 14) | (1u << 12) | (1u << 11)); const uint16_t fsk_reg59 = BK4819_ReadRegister(0x59) & ~((1u << 15) | (1u << 14) | (1u << 12) | (1u << 11));
@ -519,18 +520,22 @@ void MDC1200_process_rx(const uint16_t interrupt_bits)
mdc1200_rx_buffer[mdc1200_rx_buffer_index++] = (word >> 8) & 0xff; mdc1200_rx_buffer[mdc1200_rx_buffer_index++] = (word >> 8) & 0xff;
} }
char a[2]="R1";
UART_Send((uint8_t *)&a,2);
if (mdc1200_rx_buffer_index >= sizeof(mdc1200_rx_buffer)) if (mdc1200_rx_buffer_index >= sizeof(mdc1200_rx_buffer))
{ {
BK4819_WriteRegister(0x59, (1u << 15) | (1u << 14) | fsk_reg59); BK4819_WriteRegister(0x59, (1u << 15) | (1u << 14) | fsk_reg59);
BK4819_WriteRegister(0x59, (1u << 12) | fsk_reg59); BK4819_WriteRegister(0x59, (1u << 12) | fsk_reg59);
char a[2]="RE";
UART_Send((uint8_t *)&a,2);
if (MDC1200_process_rx_data( if (MDC1200_process_rx_data(
mdc1200_rx_buffer, mdc1200_rx_buffer,
mdc1200_rx_buffer_index, mdc1200_rx_buffer_index,
&mdc1200_op, &mdc1200_op,
&mdc1200_arg, &mdc1200_arg,
&mdc1200_unit_id)) { &mdc1200_unit_id)) {
char a[2]="OK";
UART_Send((uint8_t *)&a,2);
mdc1200_rx_ready_tick_500ms = 2 * 5; // 6 second MDC display time mdc1200_rx_ready_tick_500ms = 2 * 5; // 6 second MDC display time
gUpdateDisplay = true; gUpdateDisplay = true;

View file

@ -128,17 +128,17 @@ static uint16_t BK4819_ReadU16(void)
PORTCON_PORTC_IE = (PORTCON_PORTC_IE & ~PORTCON_PORTC_IE_C2_MASK) | PORTCON_PORTC_IE_C2_BITS_ENABLE; PORTCON_PORTC_IE = (PORTCON_PORTC_IE & ~PORTCON_PORTC_IE_C2_MASK) | PORTCON_PORTC_IE_C2_BITS_ENABLE;
GPIOC->DIR = (GPIOC->DIR & ~GPIO_DIR_2_MASK) | GPIO_DIR_2_BITS_INPUT; GPIOC->DIR = (GPIOC->DIR & ~GPIO_DIR_2_MASK) | GPIO_DIR_2_BITS_INPUT;
SYSTICK_DelayUs(1); //SYSTICK_DelayUs(1);
SYSTICK_Delay250ns(1);
Value = 0; Value = 0;
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
{ {
Value <<= 1; Value <<= 1;
Value |= GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SDA); Value |= GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SDA);
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCL); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCL);
SYSTICK_DelayUs(1); SYSTICK_Delay250ns(1);
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCL); GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCL);
SYSTICK_DelayUs(1); SYSTICK_Delay250ns(1);
} }
PORTCON_PORTC_IE = (PORTCON_PORTC_IE & ~PORTCON_PORTC_IE_C2_MASK) | PORTCON_PORTC_IE_C2_BITS_DISABLE; PORTCON_PORTC_IE = (PORTCON_PORTC_IE & ~PORTCON_PORTC_IE_C2_MASK) | PORTCON_PORTC_IE_C2_BITS_DISABLE;
GPIOC->DIR = (GPIOC->DIR & ~GPIO_DIR_2_MASK) | GPIO_DIR_2_BITS_OUTPUT; GPIOC->DIR = (GPIOC->DIR & ~GPIO_DIR_2_MASK) | GPIO_DIR_2_BITS_OUTPUT;
@ -153,14 +153,14 @@ uint16_t BK4819_ReadRegister(BK4819_REGISTER_t Register)
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCN); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCN);
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCL); GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCL);
SYSTICK_DelayUs(1); SYSTICK_Delay250ns(1);
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCN); GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCN);
BK4819_WriteU8(Register | 0x80); BK4819_WriteU8(Register | 0x80);
Value = BK4819_ReadU16(); Value = BK4819_ReadU16();
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCN); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCN);
SYSTICK_DelayUs(1); SYSTICK_Delay250ns(1);
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCL); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCL);
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SDA); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SDA);
@ -174,20 +174,20 @@ void BK4819_WriteRegister(BK4819_REGISTER_t Register, uint16_t Data)
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCN); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCN);
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCL); GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCL);
SYSTICK_DelayUs(1); SYSTICK_Delay250ns(1);
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCN); GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCN);
BK4819_WriteU8(Register); BK4819_WriteU8(Register);
SYSTICK_DelayUs(1); //SYSTICK_Delay250ns(1);
BK4819_WriteU16(Data); BK4819_WriteU16(Data);
SYSTICK_DelayUs(1); //SYSTICK_Delay250ns(1);
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCN); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCN);
SYSTICK_DelayUs(1); SYSTICK_Delay250ns(1);
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCL); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCL);
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SDA); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SDA);
@ -205,14 +205,14 @@ void BK4819_WriteU8(uint8_t Data)
else else
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SDA); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SDA);
SYSTICK_DelayUs(1); SYSTICK_Delay250ns(1);
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCL); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCL);
SYSTICK_DelayUs(1); SYSTICK_Delay250ns(1);
Data <<= 1; Data <<= 1;
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCL); GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCL);
SYSTICK_DelayUs(1); SYSTICK_Delay250ns(1);
} }
} }
@ -228,14 +228,14 @@ void BK4819_WriteU16(uint16_t Data)
else else
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SDA); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SDA);
SYSTICK_DelayUs(1); SYSTICK_Delay250ns(1);
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCL); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCL);
Data <<= 1; Data <<= 1;
SYSTICK_DelayUs(1); SYSTICK_Delay250ns(1);
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCL); GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCL);
SYSTICK_DelayUs(1); SYSTICK_Delay250ns(1);
} }
} }

View file

@ -69,31 +69,33 @@ void CRC_InitReverse(void)
return crc; return crc;
} }
uint16_t CRC_Calculate( void *pBuffer, uint16_t Size) { //uint16_t CRC_Calculate( void *pBuffer, uint16_t Size) {
// uint8_t *pData = ( uint8_t *)pBuffer;
// uint16_t crc = 0; // 初始CRC值为0
// //
// while (Size--) { // unsigned int i;
// crc ^= (*pData++) << 8; // 将数据字节的最高位与CRC异或 // uint8_t *data8 = ( uint8_t *)pBuffer;
// for (uint8_t i = 0; i < 8; i++) { // uint16_t crc = 0;
// if (crc & 0x8000) { // 检查最高位是否为1 // for (i = 0; i < Size; i++)
// crc = (crc << 1) ^ CRC16_XMODEM_POLY; // 如果最高位为1执行CRC多项式计算 // {
// } else { // unsigned int k;
// crc = crc << 1; // 如果最高位为0继续左移 // crc ^= data8[i];
// } // for (k = 8; k > 0; k--)
// } // crc = (crc & 1u) ? (crc >> 1) ^ 0x8408 : crc >> 1;
// } // }
// // return crc ^ 0xffff;
// return crc; //}
unsigned int i; uint16_t CRC_Calculate(const void *buffer, const unsigned int size)
uint8_t *data8 = ( uint8_t *)pBuffer; {
uint16_t crc = 0; const uint8_t *data = (const uint8_t *)buffer;
for (i = 0; i < Size; i++) uint16_t i;
{ uint16_t crc;
unsigned int k;
crc ^= data8[i]; CRC_CR = (CRC_CR & ~CRC_CR_CRC_EN_MASK) | CRC_CR_CRC_EN_BITS_ENABLE;
for (k = 8; k > 0; k--)
crc = (crc & 1u) ? (crc >> 1) ^ 0x8408 : crc >> 1; for (i = 0; i < size; i++)
} CRC_DATAIN = data[i];
return crc ^ 0xffff; crc = (uint16_t)CRC_DATAOUT;
CRC_CR = (CRC_CR & ~CRC_CR_CRC_EN_MASK) | CRC_CR_CRC_EN_BITS_DISABLE;
return crc;
} }

View file

@ -20,7 +20,7 @@
#include <stdint.h> #include <stdint.h>
void CRC_Init(void); void CRC_Init(void);
uint16_t CRC_Calculate( void *pBuffer, uint16_t Size); uint16_t CRC_Calculate(const void *buffer, const unsigned int size);
uint16_t CRC_Calculate1( void *pBuffer, uint16_t Size); uint16_t CRC_Calculate1( void *pBuffer, uint16_t Size);
void CRC_InitReverse(void); void CRC_InitReverse(void);

View file

@ -517,7 +517,7 @@ void SETTINGS_SaveSettings(void)
// State[2] = 0;//gEeprom.KEY_1_LONG_PRESS_ACTION; // State[2] = 0;//gEeprom.KEY_1_LONG_PRESS_ACTION;
State[3] = 0;//gEeprom.KEY_2_SHORT_PRESS_ACTION; State[3] = 0;//gEeprom.KEY_2_SHORT_PRESS_ACTION;
State[4] = 0;//gEeprom.KEY_2_LONG_PRESS_ACTION; State[4] = 0;//gEeprom.KEY_2_LONG_PRESS_ACTION;
State[5] = //gEeprom.SCAN_RESUME_MODE; State[5] = gEeprom.SCAN_RESUME_MODE;
State[6] = 0;//gEeprom.AUTO_KEYPAD_LOCK; State[6] = 0;//gEeprom.AUTO_KEYPAD_LOCK;
State[7] = 0;//gEeprom.POWER_ON_DISPLAY_MODE; State[7] = 0;//gEeprom.POWER_ON_DISPLAY_MODE;
EEPROM_WriteBuffer(0x0E90, State); EEPROM_WriteBuffer(0x0E90, State);

View file

@ -710,6 +710,7 @@ void UI_DisplayMenu(void) {
{ {
// sprintf(edit, "%04lX", gEeprom.MDC1200_ID); // %04X确保输出是4个字符长度的十六进制数 // sprintf(edit, "%04lX", gEeprom.MDC1200_ID); // %04X确保输出是4个字符长度的十六进制数
sprintf(String, "%04X", gEeprom.MDC1200_ID); // %04X确保输出是4个字符长度的十六进制数 sprintf(String, "%04X", gEeprom.MDC1200_ID); // %04X确保输出是4个字符长度的十六进制数
edit_index = -1;
edit[0]=String[0]; edit[0]=String[0];
edit[1]=String[1]; edit[1]=String[1];

View file

@ -1,3 +1,14 @@
#0.10.7
修复“搜索恢复模式设置失效”
修复“MDC ID菜单项无法输入数字切换菜单项”
TODO:“修复接收失败问题“
TODO:精简DTMF信息菜单
TODO:更新README客制部分
TODO:更新Makefile
#0.10.6
纠正MDC信令
#0.10.4 #0.10.4
在解锁全部频段下允许200M,350M,500M删除对应菜单 在解锁全部频段下允许200M,350M,500M删除对应菜单
修复“按键音开机后失效“ 修复“按键音开机后失效“