MDC联系人

This commit is contained in:
wu58430 2023-12-10 00:03:48 +08:00
parent 83f7d2e6a6
commit e8d1957a2a
15 changed files with 841 additions and 796 deletions

View file

@ -11,7 +11,7 @@
</component> </component>
<component name="CMakeRunConfigurationManager"> <component name="CMakeRunConfigurationManager">
<generated> <generated>
<config projectName="Project" targetName="uv_k5_firmware_custom_0_17" /> <config projectName="uv_k5_firmware_custom_0_17" targetName="uv_k5_firmware_custom_0_17" />
</generated> </generated>
</component> </component>
<component name="CMakeSettings"> <component name="CMakeSettings">
@ -20,13 +20,21 @@
</configurations> </configurations>
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="cea36e80-e289-4d69-9030-7186d540ac0e" name="更改" comment="clion"> <list default="true" id="cea36e80-e289-4d69-9030-7186d540ac0e" name="更改" comment="开机音修复">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Makefile" beforeDir="false" afterPath="$PROJECT_DIR$/Makefile" afterDir="false" /> <change beforePath="$PROJECT_DIR$/CMakeLists.txt" beforeDir="false" afterPath="$PROJECT_DIR$/CMakeLists.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" /> <change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/menu.c" beforeDir="false" afterPath="$PROJECT_DIR$/app/menu.c" afterDir="false" /> <change beforePath="$PROJECT_DIR$/app/mdc1200.c" beforeDir="false" afterPath="$PROJECT_DIR$/app/mdc1200.c" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/mdc1200.h" beforeDir="false" afterPath="$PROJECT_DIR$/app/mdc1200.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.25.2/CMakeCCompiler.cmake" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.25.2/CMakeCCompiler.cmake" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.25.2/CMakeCXXCompiler.cmake" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.25.2/CMakeCXXCompiler.cmake" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.25.2/CMakeDetermineCompilerABI_C.bin" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.25.2/CMakeDetermineCompilerABI_C.bin" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.25.2/CMakeSystem.cmake" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/3.25.2/CMakeSystem.cmake" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/CMakeOutput.log" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/CMakeOutput.log" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/clion-environment.txt" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/clion-environment.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.c" beforeDir="false" afterPath="$PROJECT_DIR$/main.c" afterDir="false" /> <change beforePath="$PROJECT_DIR$/main.c" beforeDir="false" afterPath="$PROJECT_DIR$/main.c" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ui/welcome.c" beforeDir="false" afterPath="$PROJECT_DIR$/ui/welcome.c" afterDir="false" /> <change beforePath="$PROJECT_DIR$/ui/main.c" beforeDir="false" afterPath="$PROJECT_DIR$/ui/main.c" afterDir="false" />
<change beforePath="$PROJECT_DIR$/win_make.bat" beforeDir="false" afterPath="$PROJECT_DIR$/win_make.bat" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -71,39 +79,34 @@
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
</component> </component>
<component name="PropertiesComponent"><![CDATA[{ <component name="PropertiesComponent">{
"keyToString": { &quot;keyToString&quot;: {
"ASKED_ADD_EXTERNAL_FILES": "true", &quot;ASKED_ADD_EXTERNAL_FILES&quot;: &quot;true&quot;,
"RunOnceActivity.OpenProjectViewOnStart": "true", &quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
"RunOnceActivity.ShowReadmeOnStart": "true", &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
"RunOnceActivity.cidr.known.project.marker": "true", &quot;RunOnceActivity.cidr.known.project.marker&quot;: &quot;true&quot;,
"SHARE_PROJECT_CONFIGURATION_FILES": "true", &quot;SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
"WebServerToolWindowFactoryState": "false", &quot;WebServerToolWindowFactoryState&quot;: &quot;false&quot;,
"cf.first.check.clang-format": "false", &quot;cf.first.check.clang-format&quot;: &quot;false&quot;,
"cidr.known.project.marker": "true", &quot;cidr.known.project.marker&quot;: &quot;true&quot;,
"last_opened_file_path": "C:/Users/RUPC/Desktop/UV-K6/uv-k5-firmware-chinese/win_make.bat", &quot;last_opened_file_path&quot;: &quot;C:/Users/RUPC/Desktop/UV-K6/uv-k5-firmware-chinese/win_make.bat&quot;,
"node.js.detected.package.eslint": "true", &quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
"node.js.detected.package.tslint": "true", &quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
"node.js.selected.package.eslint": "(autodetect)", &quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
"node.js.selected.package.tslint": "(autodetect)", &quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
"nodejs_package_manager_path": "npm", &quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
"settings.editor.selected.configurable": "File.Encoding", &quot;settings.editor.selected.configurable&quot;: &quot;File.Encoding&quot;,
"structure.view.defaults.are.configured": "true", &quot;structure.view.defaults.are.configured&quot;: &quot;true&quot;,
"vue.rearranger.settings.migration": "true" &quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
} }
}]]></component> }</component>
<component name="RecentsManager"> <component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS"> <key name="CopyFile.RECENT_KEYS">
<recent name="C:\Users\RUPC\Desktop\UV-K6\uv-k5-firmware-chinese\app" /> <recent name="C:\Users\RUPC\Desktop\UV-K6\uv-k5-firmware-chinese\app" />
<recent name="C:\Users\RUPC\Desktop\UV-K6\uv-k5-firmware-chinese" /> <recent name="C:\Users\RUPC\Desktop\UV-K6\uv-k5-firmware-chinese" />
</key> </key>
</component> </component>
<component name="RunManager" selected="Shell Script.win docker"> <component name="RunManager" selected="Shell Script.win">
<configuration default="true" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" PASS_PARENT_ENVS_2="true">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="clean" type="MAKEFILE_TARGET_RUN_CONFIGURATION" factoryName="Makefile" temporary="true"> <configuration name="clean" type="MAKEFILE_TARGET_RUN_CONFIGURATION" factoryName="Makefile" temporary="true">
<makefile filename="$PROJECT_DIR$/Makefile" target="clean" workingDirectory="" arguments=""> <makefile filename="$PROJECT_DIR$/Makefile" target="clean" workingDirectory="" arguments="">
<envs /> <envs />
@ -195,14 +198,8 @@
<workItem from="1701934352200" duration="14088000" /> <workItem from="1701934352200" duration="14088000" />
<workItem from="1702006730071" duration="3144000" /> <workItem from="1702006730071" duration="3144000" />
<workItem from="1702024305901" duration="2385000" /> <workItem from="1702024305901" duration="2385000" />
<workItem from="1702049513969" duration="14706000" /> <workItem from="1702049513969" duration="28027000" />
</task> <workItem from="1702119088204" duration="9977000" />
<task id="LOCAL-00031" summary="MDC RX">
<created>1701681045853</created>
<option name="number" value="00031" />
<option name="presentableId" value="LOCAL-00031" />
<option name="project" value="LOCAL" />
<updated>1701681045853</updated>
</task> </task>
<task id="LOCAL-00032" summary="MDC RX"> <task id="LOCAL-00032" summary="MDC RX">
<created>1701682489155</created> <created>1701682489155</created>
@ -540,7 +537,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1702093273462</updated> <updated>1702093273462</updated>
</task> </task>
<option name="localTasksCounter" value="80" /> <task id="LOCAL-00080" summary="开机音修复">
<created>1702098575234</created>
<option name="number" value="00080" />
<option name="presentableId" value="LOCAL-00080" />
<option name="project" value="LOCAL" />
<updated>1702098575234</updated>
</task>
<option name="localTasksCounter" value="81" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
@ -564,7 +568,6 @@
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value="lite aim" />
<MESSAGE value="create" /> <MESSAGE value="create" />
<MESSAGE value="fix bug" /> <MESSAGE value="fix bug" />
<MESSAGE value="掃描下翻譯" /> <MESSAGE value="掃描下翻譯" />
@ -589,6 +592,7 @@
<MESSAGE value="readme add" /> <MESSAGE value="readme add" />
<MESSAGE value="重构" /> <MESSAGE value="重构" />
<MESSAGE value="clion" /> <MESSAGE value="clion" />
<option name="LAST_COMMIT_MESSAGE" value="clion" /> <MESSAGE value="开机音修复" />
<option name="LAST_COMMIT_MESSAGE" value="开机音修复" />
</component> </component>
</project> </project>

View file

@ -816,4 +816,4 @@ add_executable(uv_k5_firmware_custom_0_17
sram-overlay.c sram-overlay.c
sram-overlay.h sram-overlay.h
version.c version.c
version.h chinese.h app/mdc1200.c app/mdc1200.c app/mdc1200.c app/mdc1200.c) version.h chinese.h app/mdc1200.c app/mdc1200.c app/mdc1200.c app/mdc1200.c app/mdc1200.c app/mdc1200.c)

View file

@ -27,8 +27,7 @@
* **短按`侧键2`**:设置宽窄带 * **短按`侧键2`**:设置宽窄带
* **长按`侧键2`**:手电筒 * **长按`侧键2`**:手电筒
**收音机界面下**
* **长按`侧键2`**:手电筒

View file

@ -5,18 +5,18 @@
#include "mdc1200.h" #include "mdc1200.h"
#include "misc.h" #include "misc.h"
#include <string.h> #include <string.h>
uint16_t MDC_ID=0X542B; #include "driver/eeprom.h"
uint16_t MDC_ID = 0X542B;
const uint8_t mdc1200_pre_amble[] = {0x00, 0x00, 0x00}; const uint8_t mdc1200_pre_amble[] = {0x00, 0x00, 0x00};
const uint8_t mdc1200_sync[5] = {0x07, 0x09, 0x2a, 0x44, 0x6f}; 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 1 #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 :)
uint16_t crc; uint16_t crc;
CRC_InitReverse(); CRC_InitReverse();
crc = CRC_Calculate(data, data_len); crc = CRC_Calculate(data, data_len);
@ -46,68 +46,63 @@ uint16_t compute_crc( void *data, const unsigned int data_len) { // let the C
#else #else
uint16_t compute_crc(const void *data, const unsigned int data_len) uint16_t compute_crc(const void *data, const unsigned int data_len)
{ {
unsigned int i; unsigned int i;
const uint8_t *data8 = (const uint8_t *)data; const uint8_t *data8 = (const uint8_t *)data;
uint16_t crc = 0; uint16_t crc = 0;
for (i = 0; i < data_len; i++) for (i = 0; i < data_len; i++)
{ {
uint8_t mask; uint8_t mask;
// bit reverse each data byte // bit reverse each data byte
const uint8_t bits = bit_reverse_8(*data8++); const uint8_t bits = bit_reverse_8(*data8++);
for (mask = 0x0080; mask != 0; mask >>= 1) for (mask = 0x0080; mask != 0; mask >>= 1)
{ {
uint16_t msb = crc & 0x8000; uint16_t msb = crc & 0x8000;
if (bits & mask) if (bits & mask)
msb ^= 0x8000; msb ^= 0x8000;
crc <<= 1; crc <<= 1;
if (msb) if (msb)
crc ^= 0x1021; crc ^= 0x1021;
} }
} }
// bit reverse and invert the final CRC // bit reverse and invert the final CRC
return bit_reverse_16(crc) ^ 0xffff; return bit_reverse_16(crc) ^ 0xffff;
} }
#endif #endif
void error_correction(void *data) void error_correction(void *data) { // can correct up to 3 or 4 corrupted bits (I think)
{ // can correct up to 3 or 4 corrupted bits (I think)
int i; int i;
uint8_t shift_reg; uint8_t shift_reg;
uint8_t syn; uint8_t syn;
uint8_t *data8 = (uint8_t *)data; uint8_t *data8 = (uint8_t *) data;
for (i = 0, shift_reg = 0, syn = 0; i < MDC1200_FEC_K; i++) for (i = 0, shift_reg = 0, syn = 0; i < MDC1200_FEC_K; i++) {
{
const uint8_t bi = data8[i]; const uint8_t bi = data8[i];
int bit_num; int bit_num;
for (bit_num = 0; bit_num < 8; bit_num++) for (bit_num = 0; bit_num < 8; bit_num++) {
{
uint8_t b; uint8_t b;
unsigned int k = 0; unsigned int k = 0;
shift_reg = (shift_reg << 1) | ((bi >> bit_num) & 1u); shift_reg = (shift_reg << 1) | ((bi >> bit_num) & 1u);
b = ((shift_reg >> 6) ^ (shift_reg >> 5) ^ (shift_reg >> 2) ^ (shift_reg >> 0)) & 1u; b = ((shift_reg >> 6) ^ (shift_reg >> 5) ^ (shift_reg >> 2) ^ (shift_reg >> 0)) & 1u;
syn = (syn << 1) | (((b ^ (data8[i + MDC1200_FEC_K] >> bit_num)) & 1u) ? 1u : 0u); syn = (syn << 1) | (((b ^ (data8[i + MDC1200_FEC_K] >> bit_num)) & 1u) ? 1u : 0u);
if (syn & 0x80) k++; if (syn & 0x80) k++;
if (syn & 0x20) k++; if (syn & 0x20) k++;
if (syn & 0x04) k++; if (syn & 0x04) k++;
if (syn & 0x02) k++; if (syn & 0x02) k++;
if (k >= 3) if (k >= 3) { // correct a bit error
{ // correct a bit error
int ii = i; int ii = i;
int bn = bit_num - 7; int bn = bit_num - 7;
if (bn < 0) if (bn < 0) {
{
bn += 8; bn += 8;
ii--; ii--;
} }
@ -119,13 +114,12 @@ void error_correction(void *data)
} }
} }
bool decode_data(void *data) bool decode_data(void *data) {
{
uint16_t crc1; uint16_t crc1;
uint16_t crc2; uint16_t crc2;
uint8_t *data8 = (uint8_t *)data; uint8_t *data8 = (uint8_t *) data;
{ // de-interleave { // de-interleave
unsigned int i; unsigned int i;
unsigned int k; unsigned int k;
@ -151,18 +145,15 @@ bool decode_data(void *data)
// 15, 31, 47, 63, 79, 95, 111 // 15, 31, 47, 63, 79, 95, 111
// de-interleave the received bits // de-interleave the received bits
for (i = 0, k = 0; i < 16; i++) for (i = 0, k = 0; i < 16; i++) {
{ for (m = 0; m < MDC1200_FEC_K; m++) {
for (m = 0; m < MDC1200_FEC_K; m++)
{
const unsigned int n = (m * 16) + i; const unsigned int n = (m * 16) + i;
deinterleaved[k++] = (data8[n >> 3] >> ((7 - n) & 7u)) & 1u; deinterleaved[k++] = (data8[n >> 3] >> ((7 - n) & 7u)) & 1u;
} }
} }
// copy the de-interleaved bits back into the data buffer // copy the de-interleaved bits back into the data buffer
for (i = 0, m = 0; i < (MDC1200_FEC_K * 2); i++) for (i = 0, m = 0; i < (MDC1200_FEC_K * 2); i++) {
{
unsigned int k; unsigned int k;
uint8_t b = 0; uint8_t b = 0;
for (k = 0; k < 8; k++) for (k = 0; k < 8; k++)
@ -181,7 +172,7 @@ bool decode_data(void *data)
// 01 80 1234 2E3E 00 6580A862DD8808 // 01 80 1234 2E3E 00 6580A862DD8808
crc1 = compute_crc(data, 4); crc1 = compute_crc(data, 4);
crc2 = ((uint16_t)data8[5] << 8) | (data8[4] << 0); crc2 = ((uint16_t) data8[5] << 8) | (data8[4] << 0);
return (crc1 == crc2) ? true : false; return (crc1 == crc2) ? true : false;
} }
@ -189,18 +180,15 @@ bool decode_data(void *data)
// ********************************************************** // **********************************************************
// TX // TX
void xor_modulation(void *data, const unsigned int size) void xor_modulation(void *data, const unsigned int size) { // exclusive-or succesive bits - the entire packet
{ // exclusive-or succesive bits - the entire packet
unsigned int i; unsigned int i;
uint8_t *data8 = (uint8_t *)data; uint8_t *data8 = (uint8_t *) data;
uint8_t prev_bit = 0; uint8_t prev_bit = 0;
for (i = 0; i < size; i++) for (i = 0; i < size; i++) {
{
int bit_num; int bit_num;
uint8_t in = data8[i]; uint8_t in = data8[i];
uint8_t out = 0; uint8_t out = 0;
for (bit_num = 7; bit_num >= 0; bit_num--) for (bit_num = 7; bit_num >= 0; bit_num--) {
{
const uint8_t new_bit = (in >> bit_num) & 1u; const uint8_t new_bit = (in >> bit_num) & 1u;
if (new_bit != prev_bit) if (new_bit != prev_bit)
out |= 1u << bit_num; // previous bit and new bit are different - send a '1' out |= 1u << bit_num; // previous bit and new bit are different - send a '1'
@ -210,8 +198,7 @@ void xor_modulation(void *data, const unsigned int size)
} }
} }
uint8_t * encode_data(void *data) uint8_t *encode_data(void *data) {
{
// R=1/2 K=7 convolutional coder // R=1/2 K=7 convolutional coder
// //
// OP ARG ID CRC STATUS FEC bits // OP ARG ID CRC STATUS FEC bits
@ -222,18 +209,16 @@ uint8_t * encode_data(void *data)
// 3. for each bit, calculate the modulo-2 sum: bit(n-0) + bit(n-2) + bit(n-5) + bit(n-6) // 3. for each bit, calculate the modulo-2 sum: bit(n-0) + bit(n-2) + bit(n-5) + bit(n-6)
// 4. then for each byte of resulting output, again reverse those bits to generate the values shown above // 4. then for each byte of resulting output, again reverse those bits to generate the values shown above
uint8_t *data8 = (uint8_t *)data; uint8_t *data8 = (uint8_t *) data;
{ // add the FEC bits to the end of the data { // add the FEC bits to the end of the data
unsigned int i; unsigned int i;
uint8_t shift_reg = 0; uint8_t shift_reg = 0;
for (i = 0; i < MDC1200_FEC_K; i++) for (i = 0; i < MDC1200_FEC_K; i++) {
{ unsigned int bit_num;
unsigned int bit_num;
const uint8_t bi = data8[i]; const uint8_t bi = data8[i];
uint8_t bo = 0; uint8_t bo = 0;
for (bit_num = 0; bit_num < 8; bit_num++) for (bit_num = 0; bit_num < 8; bit_num++) {
{
shift_reg = (shift_reg << 1) | ((bi >> bit_num) & 1u); shift_reg = (shift_reg << 1) | ((bi >> bit_num) & 1u);
bo |= (((shift_reg >> 6) ^ (shift_reg >> 5) ^ (shift_reg >> 2) ^ (shift_reg >> 0)) & 1u) << bit_num; bo |= (((shift_reg >> 6) ^ (shift_reg >> 5) ^ (shift_reg >> 2) ^ (shift_reg >> 0)) & 1u) << bit_num;
} }
@ -242,7 +227,7 @@ uint8_t * encode_data(void *data)
} }
{ // interleave the bits { // interleave the bits
unsigned int i; unsigned int i;
unsigned int k; unsigned int k;
@ -267,12 +252,10 @@ uint8_t * encode_data(void *data)
// 15, 31, 47, 63, 79, 95, 111 // 15, 31, 47, 63, 79, 95, 111
// bit interleaver // bit interleaver
for (i = 0, k = 0; i < (MDC1200_FEC_K * 2); i++) for (i = 0, k = 0; i < (MDC1200_FEC_K * 2); i++) {
{
unsigned int bit_num; unsigned int bit_num;
const uint8_t b = data8[i]; const uint8_t b = data8[i];
for (bit_num = 0; bit_num < 8; bit_num++) for (bit_num = 0; bit_num < 8; bit_num++) {
{
interleaved[k] = (b >> bit_num) & 1u; interleaved[k] = (b >> bit_num) & 1u;
k += 16; k += 16;
if (k >= sizeof(interleaved)) if (k >= sizeof(interleaved))
@ -281,8 +264,7 @@ uint8_t * encode_data(void *data)
} }
// copy the interleaved bits back to the data buffer // copy the interleaved bits back to the data buffer
for (i = 0, k = 0; i < (MDC1200_FEC_K * 2); i++) for (i = 0, k = 0; i < (MDC1200_FEC_K * 2); i++) {
{
int bit_num; int bit_num;
uint8_t b = 0; uint8_t b = 0;
for (bit_num = 7; bit_num >= 0; bit_num--) for (bit_num = 7; bit_num >= 0; bit_num--)
@ -295,11 +277,10 @@ uint8_t * encode_data(void *data)
return data8 + (MDC1200_FEC_K * 2); return data8 + (MDC1200_FEC_K * 2);
} }
unsigned int MDC1200_encode_single_packet(void *data, const uint8_t op, const uint8_t arg, const uint16_t unit_id) unsigned int MDC1200_encode_single_packet(void *data, const uint8_t op, const uint8_t arg, const uint16_t unit_id) {
{
unsigned int size; unsigned int size;
uint16_t crc; uint16_t crc;
uint8_t *p = (uint8_t *)data; uint8_t *p = (uint8_t *) data;
memcpy(p, mdc1200_pre_amble, sizeof(mdc1200_pre_amble)); memcpy(p, mdc1200_pre_amble, sizeof(mdc1200_pre_amble));
p += sizeof(mdc1200_pre_amble); p += sizeof(mdc1200_pre_amble);
@ -317,7 +298,7 @@ unsigned int MDC1200_encode_single_packet(void *data, const uint8_t op, const ui
p = encode_data(p); p = encode_data(p);
size = (unsigned int)(p - (uint8_t *)data); size = (unsigned int) (p - (uint8_t *) data);
xor_modulation(data, size); xor_modulation(data, size);
@ -326,19 +307,18 @@ unsigned int MDC1200_encode_single_packet(void *data, const uint8_t op, const ui
struct { struct {
uint8_t bit; uint8_t bit;
uint8_t prev_bit; uint8_t prev_bit;
uint8_t xor_bit; uint8_t xor_bit;
uint64_t shift_reg; uint64_t shift_reg;
unsigned int bit_count; unsigned int bit_count;
unsigned int stage; unsigned int stage;
bool inverted_sync; bool inverted_sync;
unsigned int data_index; unsigned int data_index;
uint8_t data[40]; uint8_t data[40];
} rx; } rx;
void MDC1200_reset_rx(void) void MDC1200_reset_rx(void) {
{
memset(&rx, 0, sizeof(rx)); memset(&rx, 0, sizeof(rx));
} }
@ -348,10 +328,9 @@ bool MDC1200_process_rx_data(
//const bool inverted, //const bool inverted,
uint8_t *op, uint8_t *op,
uint8_t *arg, uint8_t *arg,
uint16_t *unit_id) uint16_t *unit_id) {
{ const uint8_t *buffer8 = (const uint8_t *) buffer;
const uint8_t *buffer8 = (const uint8_t *)buffer; unsigned int index;
unsigned int index;
// 04 8D BF 66 58 sync // 04 8D BF 66 58 sync
// FB 72 40 99 A7 inverted sync // FB 72 40 99 A7 inverted sync
@ -361,13 +340,11 @@ bool MDC1200_process_rx_data(
memset(&rx, 0, sizeof(rx)); memset(&rx, 0, sizeof(rx));
for (index = 0; index < size; index++) for (index = 0; index < size; index++) {
{ int bit;
int bit;
const uint8_t rx_byte = buffer8[index]; const uint8_t rx_byte = buffer8[index];
for (bit = 7; bit >= 0; bit--) for (bit = 7; bit >= 0; bit--) {
{
unsigned int i; unsigned int i;
rx.prev_bit = rx.bit; rx.prev_bit = rx.bit;
@ -381,13 +358,11 @@ bool MDC1200_process_rx_data(
// ********* // *********
if (rx.stage == 0) if (rx.stage == 0) { // looking for the 40-bit sync pattern
{ // looking for the 40-bit sync pattern
const unsigned int sync_bit_ok_threshold = 32; const unsigned int sync_bit_ok_threshold = 32;
if (rx.bit_count >= 40) if (rx.bit_count >= 40) {
{
// 40-bit sync pattern // 40-bit sync pattern
uint64_t sync_nor = 0x07092a446fu; // normal uint64_t sync_nor = 0x07092a446fu; // normal
uint64_t sync_inv = 0xffffffffffu ^ sync_nor; // bit inverted uint64_t sync_inv = 0xffffffffffu ^ sync_nor; // bit inverted
@ -397,8 +372,7 @@ bool MDC1200_process_rx_data(
unsigned int nor_count = 0; unsigned int nor_count = 0;
unsigned int inv_count = 0; unsigned int inv_count = 0;
for (i = 40; i > 0; i--, sync_nor >>= 1, sync_inv >>= 1) for (i = 40; i > 0; i--, sync_nor >>= 1, sync_inv >>= 1) {
{
nor_count += sync_nor & 1u; nor_count += sync_nor & 1u;
inv_count += sync_inv & 1u; inv_count += sync_inv & 1u;
} }
@ -406,14 +380,12 @@ bool MDC1200_process_rx_data(
inv_count = 40 - inv_count; inv_count = 40 - inv_count;
if (nor_count >= sync_bit_ok_threshold || inv_count >= sync_bit_ok_threshold) { // good enough
if (nor_count >= sync_bit_ok_threshold || inv_count >= sync_bit_ok_threshold)
{ // good enough
rx.inverted_sync = (inv_count > nor_count) ? true : false; rx.inverted_sync = (inv_count > nor_count) ? true : false;
rx.data_index = 0; rx.data_index = 0;
rx.bit_count = 0; rx.bit_count = 0;
rx.stage = 1; rx.stage = 1;
} }
@ -433,20 +405,17 @@ bool MDC1200_process_rx_data(
continue; continue;
if (!decode_data(rx.data)) {
if (!decode_data(rx.data))
{
MDC1200_reset_rx(); MDC1200_reset_rx();
continue; continue;
} }
// extract the info from the packet // extract the info from the packet
*op = rx.data[0]; *op = rx.data[0];
*arg = rx.data[1]; *arg = rx.data[1];
*unit_id = ((uint16_t)rx.data[2] << 8) | (rx.data[3] << 0); *unit_id = ((uint16_t) rx.data[2] << 8) | (rx.data[3] << 0);
// reset the detector // reset the detector
@ -461,28 +430,25 @@ bool MDC1200_process_rx_data(
return false; return false;
} }
uint8_t mdc1200_rx_buffer[sizeof(mdc1200_sync_suc_xor) + (MDC1200_FEC_K * 2)]; uint8_t mdc1200_rx_buffer[sizeof(mdc1200_sync_suc_xor) + (MDC1200_FEC_K * 2)];
unsigned int mdc1200_rx_buffer_index = 0; unsigned int mdc1200_rx_buffer_index = 0;
uint8_t mdc1200_op; uint8_t mdc1200_op;
uint8_t mdc1200_arg; uint8_t mdc1200_arg;
uint16_t mdc1200_unit_id; uint16_t mdc1200_unit_id;
uint8_t mdc1200_rx_ready_tick_500ms; 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) 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 rx_sync_flags = BK4819_ReadRegister(0x0B); const bool rx_sync = (interrupt_bits & BK4819_REG_02_FSK_RX_SYNC) ? true : false;
const uint16_t fsk_reg59 = BK4819_ReadRegister(0x59) & ~((1u << 15) | (1u << 14) | (1u << 12) | (1u << 11)); const bool rx_sync_neg = (rx_sync_flags & (1u << 7)) ? true : false;
const bool rx_sync = (interrupt_bits & BK4819_REG_02_FSK_RX_SYNC) ? true : false;
const bool rx_sync_neg = (rx_sync_flags & (1u << 7)) ? true : false;
const bool rx_fifo_almost_full = (interrupt_bits & BK4819_REG_02_FSK_FIFO_ALMOST_FULL) ? true : false; const bool rx_fifo_almost_full = (interrupt_bits & BK4819_REG_02_FSK_FIFO_ALMOST_FULL) ? true : false;
const bool rx_finished = (interrupt_bits & BK4819_REG_02_FSK_RX_FINISHED) ? true : false; const bool rx_finished = (interrupt_bits & BK4819_REG_02_FSK_RX_FINISHED) ? true : false;
if (rx_sync) if (rx_sync) {
{
mdc1200_rx_buffer_index = 0; mdc1200_rx_buffer_index = 0;
{ {
@ -493,25 +459,18 @@ void MDC1200_process_rx(const uint16_t interrupt_bits)
} }
} }
if (rx_fifo_almost_full) if (rx_fifo_almost_full) {
{
unsigned int i; unsigned int i;
const unsigned int count = BK4819_ReadRegister(0x5E) & (7u << 0); // almost full threshold const unsigned int count = BK4819_ReadRegister(0x5E) & (7u << 0); // almost full threshold
// fetch received packet data // fetch received packet data
for (i = 0; i < count; i++) for (i = 0; i < count; i++) {
{
const uint16_t word = BK4819_ReadRegister(0x5F) ^ (rx_sync_neg ? 0xFFFF : 0x0000); const uint16_t word = BK4819_ReadRegister(0x5F) ^ (rx_sync_neg ? 0xFFFF : 0x0000);
if (mdc1200_rx_buffer_index < sizeof(mdc1200_rx_buffer)) if (mdc1200_rx_buffer_index < sizeof(mdc1200_rx_buffer))
mdc1200_rx_buffer[mdc1200_rx_buffer_index++] = (word >> 0) & 0xff; mdc1200_rx_buffer[mdc1200_rx_buffer_index++] = (word >> 0) & 0xff;
@ -520,8 +479,7 @@ void MDC1200_process_rx(const uint16_t interrupt_bits)
} }
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);
@ -531,7 +489,6 @@ void MDC1200_process_rx(const uint16_t interrupt_bits)
&mdc1200_op, &mdc1200_op,
&mdc1200_arg, &mdc1200_arg,
&mdc1200_unit_id)) { &mdc1200_unit_id)) {
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;
@ -541,8 +498,7 @@ void MDC1200_process_rx(const uint16_t interrupt_bits)
} }
} }
if (rx_finished) if (rx_finished) {
{
mdc1200_rx_buffer_index = 0; mdc1200_rx_buffer_index = 0;
@ -555,14 +511,13 @@ void MDC1200_process_rx(const uint16_t interrupt_bits)
} }
void MDC1200_init(void) {
void MDC1200_init(void)
{
memcpy(mdc1200_sync_suc_xor, mdc1200_sync, sizeof(mdc1200_sync)); memcpy(mdc1200_sync_suc_xor, mdc1200_sync, sizeof(mdc1200_sync));
xor_modulation(mdc1200_sync_suc_xor, sizeof(mdc1200_sync_suc_xor)); xor_modulation(mdc1200_sync_suc_xor, sizeof(mdc1200_sync_suc_xor));
MDC1200_reset_rx(); MDC1200_reset_rx();
} }
uint16_t extractHex(const char *str) { uint16_t extractHex(const char *str) {
uint16_t result = 0; uint16_t result = 0;
while (*str) { while (*str) {
@ -577,4 +532,55 @@ uint16_t extractHex(const char *str) {
} }
} }
return result; return result;
} }
uint8_t contact_num=0;
uint16_t MDC_ADD[4] = {0x1D48, 0x1D88, 0x1DC8,0x1F08};
void mdc1200_update_contact_num()
{
EEPROM_ReadBuffer(MDC_NUM_ADD, (uint8_t *)&contact_num, 1);
if(contact_num>MAX_CONTACT_NUM)contact_num=0;
}
bool mdc1200_contact_find(uint16_t mdc_id, char *contact) {
mdc1200_update_contact_num();
uint8_t add = 0;
for (uint8_t i = 0; i < contact_num; i++) {
uint8_t read_once[16]={0};
if ((i & 3) == 0 && i) add++;
EEPROM_ReadBuffer(MDC_ADD[add] + i * 16, read_once, 16);
if (mdc_id == (uint16_t) (read_once[0] | (read_once[1] << 8))) {
for (int j = 0; j < 14; ++j) {
if(read_once[2+j]<' '||read_once[2+j]>'~')
return false;
memcpy(contact,read_once+2,14);
}
return true;
}
}
return false;
}
//uint8_t A[64];
// memset(A,'A',6*16);
// for (int i = MDC_ADD1; i < MDC_ADD1+64; ++i) {
// EEPROM_WriteBuffer(i,&A[i-MDC_ADD1]);
// }
//
// for (int i = MDC_ADD2+72; i <MDC_ADD2+64; ++i) {
// EEPROM_WriteBuffer(i,&A[i-MDC_ADD2]);
// }
// for (int i =MDC_ADD3; i < MDC_ADD3+64; ++i) {
// EEPROM_WriteBuffer(i,&A[i-MDC_ADD3]);
// }
// for (int i =MDC_ADD4; i < MDC_ADD4+64; ++i) {
// EEPROM_WriteBuffer(i,&A[i-MDC_ADD4]);
// }
// EEPROM_ReadBuffer(MDC_ADD1, A, sizeof(A));
// UART_Send(A,64);
// EEPROM_ReadBuffer(MDC_ADD2, A, sizeof(A));
// UART_Send(A,64);
// EEPROM_ReadBuffer(MDC_ADD3, A, sizeof(A));
// UART_Send(A,64);
// EEPROM_ReadBuffer(MDC_ADD4, A, sizeof(A));
// UART_Send(A,64);

View file

@ -95,6 +95,8 @@ extern uint8_t mdc1200_sync_suc_xor[sizeof(mdc1200_sync)];
extern uint8_t mdc1200_op; extern uint8_t mdc1200_op;
extern uint8_t mdc1200_arg; extern uint8_t mdc1200_arg;
extern uint16_t mdc1200_unit_id; extern uint16_t mdc1200_unit_id;
bool mdc1200_contact_find(uint16_t mdc_id, char *contact) ;
extern uint8_t mdc1200_rx_ready_tick_500ms; extern uint8_t mdc1200_rx_ready_tick_500ms;
unsigned int MDC1200_encode_single_packet(void *data, const uint8_t op, const uint8_t arg, const uint16_t unit_id); unsigned int MDC1200_encode_single_packet(void *data, const uint8_t op, const uint8_t arg, const uint16_t unit_id);
@ -104,5 +106,9 @@ void MDC1200_process_rx(const uint16_t interrupt_bits);
void MDC1200_init(void); void MDC1200_init(void);
extern uint16_t MDC_ID; extern uint16_t MDC_ID;
uint16_t extractHex(const char *str); uint16_t extractHex(const char *str);
extern uint16_t MDC_ADD[4] ;
#define MDC_NUM_ADD 0X1D00
#define MAX_CONTACT_NUM 15
extern uint8_t contact_num;
#endif #endif

View file

@ -1,19 +1,19 @@
set(CMAKE_C_COMPILER "/Library/Developer/CommandLineTools/usr/bin/cc") set(CMAKE_C_COMPILER "C:/Qt/Qt5.13.1/Tools/mingw730_64/bin/gcc.exe")
set(CMAKE_C_COMPILER_ARG1 "") set(CMAKE_C_COMPILER_ARG1 "")
set(CMAKE_C_COMPILER_ID "AppleClang") set(CMAKE_C_COMPILER_ID "GNU")
set(CMAKE_C_COMPILER_VERSION "14.0.0.14000029") set(CMAKE_C_COMPILER_VERSION "7.3.0")
set(CMAKE_C_COMPILER_VERSION_INTERNAL "") set(CMAKE_C_COMPILER_VERSION_INTERNAL "")
set(CMAKE_C_COMPILER_WRAPPER "") set(CMAKE_C_COMPILER_WRAPPER "")
set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "17") set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "11")
set(CMAKE_C_EXTENSIONS_COMPUTED_DEFAULT "ON") set(CMAKE_C_EXTENSIONS_COMPUTED_DEFAULT "ON")
set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert;c_std_17;c_std_23") set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert")
set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes") set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes")
set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros") set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros")
set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert") set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert")
set(CMAKE_C17_COMPILE_FEATURES "c_std_17") set(CMAKE_C17_COMPILE_FEATURES "")
set(CMAKE_C23_COMPILE_FEATURES "c_std_23") set(CMAKE_C23_COMPILE_FEATURES "")
set(CMAKE_C_PLATFORM_ID "Darwin") set(CMAKE_C_PLATFORM_ID "MinGW")
set(CMAKE_C_SIMULATE_ID "") set(CMAKE_C_SIMULATE_ID "")
set(CMAKE_C_COMPILER_FRONTEND_VARIANT "") set(CMAKE_C_COMPILER_FRONTEND_VARIANT "")
set(CMAKE_C_SIMULATE_VERSION "") set(CMAKE_C_SIMULATE_VERSION "")
@ -21,13 +21,13 @@ set(CMAKE_C_SIMULATE_VERSION "")
set(CMAKE_AR "/Library/Developer/CommandLineTools/usr/bin/ar") set(CMAKE_AR "C:/Qt/Qt5.13.1/Tools/mingw730_64/bin/ar.exe")
set(CMAKE_C_COMPILER_AR "") set(CMAKE_C_COMPILER_AR "C:/Qt/Qt5.13.1/Tools/mingw730_64/bin/gcc-ar.exe")
set(CMAKE_RANLIB "/Library/Developer/CommandLineTools/usr/bin/ranlib") set(CMAKE_RANLIB "C:/Qt/Qt5.13.1/Tools/mingw730_64/bin/ranlib.exe")
set(CMAKE_C_COMPILER_RANLIB "") set(CMAKE_C_COMPILER_RANLIB "C:/Qt/Qt5.13.1/Tools/mingw730_64/bin/gcc-ranlib.exe")
set(CMAKE_LINKER "/Library/Developer/CommandLineTools/usr/bin/ld") set(CMAKE_LINKER "C:/Qt/Qt5.13.1/Tools/mingw730_64/bin/ld.exe")
set(CMAKE_MT "") set(CMAKE_MT "")
set(CMAKE_COMPILER_IS_GNUCC ) set(CMAKE_COMPILER_IS_GNUCC 1)
set(CMAKE_C_COMPILER_LOADED 1) set(CMAKE_C_COMPILER_LOADED 1)
set(CMAKE_C_COMPILER_WORKS TRUE) set(CMAKE_C_COMPILER_WORKS TRUE)
set(CMAKE_C_ABI_COMPILED TRUE) set(CMAKE_C_ABI_COMPILED TRUE)
@ -66,7 +66,7 @@ endif()
set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include;/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include;/Library/Developer/CommandLineTools/usr/include") set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "C:/Qt/Qt5.13.1/Tools/mingw730_64/lib/gcc/x86_64-w64-mingw32/7.3.0/include;C:/Qt/Qt5.13.1/Tools/mingw730_64/lib/gcc/x86_64-w64-mingw32/7.3.0/include-fixed;C:/Qt/Qt5.13.1/Tools/mingw730_64/x86_64-w64-mingw32/include")
set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "") set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "mingw32;gcc;moldname;mingwex;pthread;advapi32;shell32;user32;kernel32;iconv;mingw32;gcc;moldname;mingwex")
set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/lib") set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "C:/Qt/Qt5.13.1/Tools/mingw730_64/lib/gcc/x86_64-w64-mingw32/7.3.0;C:/Qt/Qt5.13.1/Tools/mingw730_64/lib/gcc;C:/Qt/Qt5.13.1/Tools/mingw730_64/x86_64-w64-mingw32/lib;C:/Qt/Qt5.13.1/Tools/mingw730_64/lib")
set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/System/Library/Frameworks") set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")

View file

@ -1,20 +1,20 @@
set(CMAKE_CXX_COMPILER "/Library/Developer/CommandLineTools/usr/bin/c++") set(CMAKE_CXX_COMPILER "C:/Qt/Qt5.13.1/Tools/mingw730_64/bin/g++.exe")
set(CMAKE_CXX_COMPILER_ARG1 "") set(CMAKE_CXX_COMPILER_ARG1 "")
set(CMAKE_CXX_COMPILER_ID "AppleClang") set(CMAKE_CXX_COMPILER_ID "GNU")
set(CMAKE_CXX_COMPILER_VERSION "14.0.0.14000029") set(CMAKE_CXX_COMPILER_VERSION "7.3.0")
set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "") set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "")
set(CMAKE_CXX_COMPILER_WRAPPER "") set(CMAKE_CXX_COMPILER_WRAPPER "")
set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "98") set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "14")
set(CMAKE_CXX_EXTENSIONS_COMPUTED_DEFAULT "ON") set(CMAKE_CXX_EXTENSIONS_COMPUTED_DEFAULT "ON")
set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17;cxx_std_20;cxx_std_23") set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17")
set(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters") set(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters")
set(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates") set(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates")
set(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates") set(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates")
set(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17") set(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17")
set(CMAKE_CXX20_COMPILE_FEATURES "cxx_std_20") set(CMAKE_CXX20_COMPILE_FEATURES "")
set(CMAKE_CXX23_COMPILE_FEATURES "cxx_std_23") set(CMAKE_CXX23_COMPILE_FEATURES "")
set(CMAKE_CXX_PLATFORM_ID "Darwin") set(CMAKE_CXX_PLATFORM_ID "MinGW")
set(CMAKE_CXX_SIMULATE_ID "") set(CMAKE_CXX_SIMULATE_ID "")
set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "") set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "")
set(CMAKE_CXX_SIMULATE_VERSION "") set(CMAKE_CXX_SIMULATE_VERSION "")
@ -22,13 +22,13 @@ set(CMAKE_CXX_SIMULATE_VERSION "")
set(CMAKE_AR "/Library/Developer/CommandLineTools/usr/bin/ar") set(CMAKE_AR "C:/Qt/Qt5.13.1/Tools/mingw730_64/bin/ar.exe")
set(CMAKE_CXX_COMPILER_AR "") set(CMAKE_CXX_COMPILER_AR "C:/Qt/Qt5.13.1/Tools/mingw730_64/bin/gcc-ar.exe")
set(CMAKE_RANLIB "/Library/Developer/CommandLineTools/usr/bin/ranlib") set(CMAKE_RANLIB "C:/Qt/Qt5.13.1/Tools/mingw730_64/bin/ranlib.exe")
set(CMAKE_CXX_COMPILER_RANLIB "") set(CMAKE_CXX_COMPILER_RANLIB "C:/Qt/Qt5.13.1/Tools/mingw730_64/bin/gcc-ranlib.exe")
set(CMAKE_LINKER "/Library/Developer/CommandLineTools/usr/bin/ld") set(CMAKE_LINKER "C:/Qt/Qt5.13.1/Tools/mingw730_64/bin/ld.exe")
set(CMAKE_MT "") set(CMAKE_MT "")
set(CMAKE_COMPILER_IS_GNUCXX ) set(CMAKE_COMPILER_IS_GNUCXX 1)
set(CMAKE_CXX_COMPILER_LOADED 1) set(CMAKE_CXX_COMPILER_LOADED 1)
set(CMAKE_CXX_COMPILER_WORKS TRUE) set(CMAKE_CXX_COMPILER_WORKS TRUE)
set(CMAKE_CXX_ABI_COMPILED TRUE) set(CMAKE_CXX_ABI_COMPILED TRUE)
@ -77,7 +77,7 @@ endif()
set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1;/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include;/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include;/Library/Developer/CommandLineTools/usr/include") set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "C:/Qt/Qt5.13.1/Tools/mingw730_64/lib/gcc/x86_64-w64-mingw32/7.3.0/include/c++;C:/Qt/Qt5.13.1/Tools/mingw730_64/lib/gcc/x86_64-w64-mingw32/7.3.0/include/c++/x86_64-w64-mingw32;C:/Qt/Qt5.13.1/Tools/mingw730_64/lib/gcc/x86_64-w64-mingw32/7.3.0/include/c++/backward;C:/Qt/Qt5.13.1/Tools/mingw730_64/lib/gcc/x86_64-w64-mingw32/7.3.0/include;C:/Qt/Qt5.13.1/Tools/mingw730_64/lib/gcc/x86_64-w64-mingw32/7.3.0/include-fixed;C:/Qt/Qt5.13.1/Tools/mingw730_64/x86_64-w64-mingw32/include")
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "c++") set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "stdc++;mingw32;gcc_s;gcc;moldname;mingwex;pthread;advapi32;shell32;user32;kernel32;iconv;mingw32;gcc_s;gcc;moldname;mingwex")
set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/lib") set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "C:/Qt/Qt5.13.1/Tools/mingw730_64/lib/gcc/x86_64-w64-mingw32/7.3.0;C:/Qt/Qt5.13.1/Tools/mingw730_64/lib/gcc;C:/Qt/Qt5.13.1/Tools/mingw730_64/x86_64-w64-mingw32/lib;C:/Qt/Qt5.13.1/Tools/mingw730_64/lib")
set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/System/Library/Frameworks") set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")

View file

@ -1,14 +1,14 @@
set(CMAKE_HOST_SYSTEM "Darwin-21.6.0") set(CMAKE_HOST_SYSTEM "Windows-10.0.19045")
set(CMAKE_HOST_SYSTEM_NAME "Darwin") set(CMAKE_HOST_SYSTEM_NAME "Windows")
set(CMAKE_HOST_SYSTEM_VERSION "21.6.0") set(CMAKE_HOST_SYSTEM_VERSION "10.0.19045")
set(CMAKE_HOST_SYSTEM_PROCESSOR "arm64") set(CMAKE_HOST_SYSTEM_PROCESSOR "AMD64")
set(CMAKE_SYSTEM "Darwin-21.6.0") set(CMAKE_SYSTEM "Windows-10.0.19045")
set(CMAKE_SYSTEM_NAME "Darwin") set(CMAKE_SYSTEM_NAME "Windows")
set(CMAKE_SYSTEM_VERSION "21.6.0") set(CMAKE_SYSTEM_VERSION "10.0.19045")
set(CMAKE_SYSTEM_PROCESSOR "arm64") set(CMAKE_SYSTEM_PROCESSOR "AMD64")
set(CMAKE_CROSSCOMPILING "FALSE") set(CMAKE_CROSSCOMPILING "FALSE")

File diff suppressed because it is too large Load diff

26
main.c
View file

@ -15,6 +15,7 @@
*/ */
#include "ui/ui.h" #include "ui/ui.h"
#include <string.h> #include <string.h>
#include <stdio.h> // NULL #include <stdio.h> // NULL
#include "app/mdc1200.h" #include "app/mdc1200.h"
#include "app/uart.h" #include "app/uart.h"
@ -42,7 +43,7 @@
#include "ui/welcome.h" #include "ui/welcome.h"
#include "ui/menu.h" #include "ui/menu.h"
#include "version.h" #include "version.h"
#include "driver/eeprom.h"
void _putchar(char c) void _putchar(char c)
{ {
UART_Send((uint8_t *)&c, 1); UART_Send((uint8_t *)&c, 1);
@ -131,7 +132,7 @@ void Main(void)
boot_counter_10ms=250; boot_counter_10ms=250;
while (boot_counter_10ms > 0) while (boot_counter_10ms > 0)
{ {
if (KEYBOARD_Poll() != KEY_INVALID) if (KEYBOARD_Poll() == KEY_EXIT)
{ // halt boot beeps { // halt boot beeps
boot_counter_10ms = 0; boot_counter_10ms = 0;
break; break;
@ -184,12 +185,25 @@ void Main(void)
RADIO_ConfigureNOAA(); RADIO_ConfigureNOAA();
#endif #endif
// ****************** // uint8_t B[64];
// } // memset(B,'B',sizeof (B));
// for ( uint16_t j = 0; j < ARRAY_SIZE(MDC_ADD); ++j) {
// for (uint16_t i =MDC_ADD[j]; i < MDC_ADD[j]+64; ++i) {
// EEPROM_WriteBuffer(i,&B[i-MDC_ADD[j]]);
// }
// }
//
//
// uint8_t A[16]={0XFF,0XFF,'B','G','2','F','Z','V',' ','U','V','K','5',' ','S','B'};
// for (int i =MDC_ADD[0]; i < MDC_ADD[0]+16; ++i) {
// EEPROM_WriteBuffer(i,&A[i-MDC_ADD[0]]);
// }
while (1) while (1)
{ {
APP_Update();
APP_Update();
if (gNextTimeslice) if (gNextTimeslice)
{ {

View file

@ -16,21 +16,22 @@
### 收款码 ### 收款码
| 赞助商 | 渠道 | 金额 | 时间 | | 赞助商 | 渠道 | 金额 | 时间 |
|-----------|-------|-------:|------------| |-----------|-------|------------:|------------|
| 忠 | 微信打赏 | ¥20.00 | 2023-11-19 | | 忠 | 微信打赏 | ¥20.00 | 2023-11-19 |
| BG6SNG | 支付宝打赏 | ¥10.00 | 2023-11-20 | | BG6SNG | 支付宝打赏 | ¥10.00 | 2023-11-20 |
| 江璐璐 | 支付宝打赏 | ¥10.00 | 2023-11-21 | | 江璐璐 | 支付宝打赏 | ¥10.00 | 2023-11-21 |
| 济南黄河业余无线电 | 微信打赏 | ¥25.00 | 2023-11-22 | | 济南黄河业余无线电 | 微信打赏 | ¥25.00 | 2023-11-22 |
| DE.BG9JAQ | 微信打赏 | ¥9.99 | 2023-11-22 | | DE.BG9JAQ | 微信打赏 | ¥9.99 | 2023-11-22 |
| 井之水 | 微信打赏 | ¥9.90 | 2023-11-22 | | 井之水 | 微信打赏 | ¥9.90 | 2023-11-22 |
| 姜先生 | 微信打赏 | ¥66.61 | 2023-11-28 | | 姜先生 | 微信打赏 | ¥66.61 | 2023-11-28 |
| Hui-Shao | 支付宝打赏 | ¥10.00 | 2023-11-29 | | Hui-Shao | 支付宝打赏 | ¥10.00 | 2023-11-29 |
| BI1OWT | 支付宝打赏 | ¥10.00 | 2023-12-01 | | BI1OWT | 支付宝打赏 | ¥10.00 | 2023-12-01 |
| 蛋 | 微信打赏 | ¥6.66 | 2023-12-01 | | 蛋 | 微信打赏 | ¥6.66 | 2023-12-01 |
| J*n | 微信打赏 | ¥10.00 | 2023-12-04 | | J*n | 微信打赏 | ¥10.00 | 2023-12-04 |
| BG2FYX | 支付宝打赏 | ¥20.00 | 2023-12-06 | | BG2FYX | 支付宝打赏 | ¥20.00 | 2023-12-06 |
| 井之水 | 微信打赏 | ¥9.90 | 2023-12-08 | | 井之水 | 微信打赏 | ¥9.90 | 2023-12-08 |
| BA7LFZ | 微信打赏 | **¥100.00** | 2023-12-09 |

View file

@ -732,54 +732,63 @@ void UI_DisplayMain(void) {
const bool rx = FUNCTION_IsRx(); const bool rx = FUNCTION_IsRx();
#ifdef ENABLE_MDC1200 #ifdef ENABLE_MDC1200
if (mdc1200_rx_ready_tick_500ms > 0)
{
if (mdc1200_rx_ready_tick_500ms > 0) {
char mdc1200_contact[14];
center_line = CENTER_LINE_MDC1200; center_line = CENTER_LINE_MDC1200;
#ifdef ENABLE_MDC1200_SHOW_OP_ARG uint8_t print_col = 0;
sprintf(String, "MDC1200 %02X %02X %04X", mdc1200_op, mdc1200_arg, mdc1200_unit_id); if (mdc1200_contact_find(mdc1200_unit_id, mdc1200_contact))//
#else {
sprintf(String, "MDC1200 ID %04X", mdc1200_unit_id);
#endif memcpy(String, mdc1200_contact, 14);
#ifdef ENABLE_SMALL_BOLD String[14] = 0;
UI_PrintStringSmallBold(String, 2, 0, 3); print_col = 29;
#else } else {
UI_PrintStringSmall(String, 2, 0, 3); sprintf(String, "ID %04X", mdc1200_unit_id);
#endif print_col = 40;
} }
else
//#ifdef ENABLE_MDC1200_SHOW_OP_ARG
// sprintf(String, "MDC1200 %02X %02X %04X", mdc1200_op, mdc1200_arg, mdc1200_unit_id);
//#else
// sprintf(String, "MDC1200 ID %04X", mdc1200_unit_id);
//#endif
UI_PrintStringSmallBold(String, print_col, 0, 3);
} else
#endif #endif
#ifdef ENABLE_AUDIO_BAR #ifdef ENABLE_AUDIO_BAR
if (gCurrentFunction == FUNCTION_TRANSMIT) { if (gCurrentFunction == FUNCTION_TRANSMIT) {
center_line = CENTER_LINE_AUDIO_BAR; center_line = CENTER_LINE_AUDIO_BAR;
UI_DisplayAudioBar(); UI_DisplayAudioBar();
} }
else else
#endif #endif
#if defined(ENABLE_AM_FIX) && defined(ENABLE_AM_FIX_SHOW_DATA) #if defined(ENABLE_AM_FIX) && defined(ENABLE_AM_FIX_SHOW_DATA)
if (rx && gEeprom.VfoInfo[gEeprom.RX_VFO].Modulation == MODULATION_AM && gSetting_AM_fix) if (rx && gEeprom.VfoInfo[gEeprom.RX_VFO].Modulation == MODULATION_AM && gSetting_AM_fix)
{ {
if (gScreenToDisplay != DISPLAY_MAIN if (gScreenToDisplay != DISPLAY_MAIN
#ifdef ENABLE_DTMF_CALLING #ifdef ENABLE_DTMF_CALLING
|| gDTMF_CallState != DTMF_CALL_STATE_NONE || gDTMF_CallState != DTMF_CALL_STATE_NONE
#endif #endif
) )
return; return;
center_line = CENTER_LINE_AM_FIX_DATA; center_line = CENTER_LINE_AM_FIX_DATA;
AM_fix_print_data(gEeprom.RX_VFO, String); AM_fix_print_data(gEeprom.RX_VFO, String);
UI_PrintStringSmall(String, 2, 0, 3); UI_PrintStringSmall(String, 2, 0, 3);
} }
else else
#endif #endif
#ifdef ENABLE_RSSI_BAR #ifdef ENABLE_RSSI_BAR
if (rx) { if (rx) {
center_line = CENTER_LINE_RSSI; center_line = CENTER_LINE_RSSI;
DisplayRSSIBar(false); DisplayRSSIBar(false);
} }
else else
#endif #endif
if (rx || gCurrentFunction == FUNCTION_FOREGROUND || gCurrentFunction == FUNCTION_POWER_SAVE) { if (rx || gCurrentFunction == FUNCTION_FOREGROUND || gCurrentFunction == FUNCTION_POWER_SAVE) {

View file

@ -28,7 +28,7 @@
:: Do the compile :: Do the compile
:: ::
make clean ::make clean
make make
:: If you have python installed, you can create a 'packed' .bin from the compiled firmware.bin file. :: If you have python installed, you can create a 'packed' .bin from the compiled firmware.bin file.
:: The Quansheng windows upload-to-radio program requires a 'packed' .bin file. :: The Quansheng windows upload-to-radio program requires a 'packed' .bin file.