Skip to content

Commit

Permalink
修复时间亚音
Browse files Browse the repository at this point in the history
  • Loading branch information
losehu committed Feb 5, 2024
1 parent ca7a6b9 commit eda1812
Show file tree
Hide file tree
Showing 18 changed files with 173 additions and 215 deletions.
1 change: 0 additions & 1 deletion .idea/.name

This file was deleted.

14 changes: 0 additions & 14 deletions .idea/deployment.xml

This file was deleted.

15 changes: 0 additions & 15 deletions .idea/encodings.xml

This file was deleted.

5 changes: 0 additions & 5 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/uv-k5-firmware-chinese.iml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

97 changes: 51 additions & 46 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ENABLE_LTO ?= 1
# ---- STOCK QUANSHENG FERATURES ----
ENABLE_UART ?= 1
ENABLE_AIRCOPY ?= 0
ENABLE_FMRADIO ?= 1
ENABLE_FMRADIO ?= 0
ENABLE_NOAA ?= 0
ENABLE_VOICE ?= 0
ENABLE_VOX ?= 1
Expand Down
20 changes: 17 additions & 3 deletions app/doppler.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

struct satellite_t satellite;
struct satellite_d satellite_data;

bool DOPPLER_FLAG=true;
//0x02BA0~0x2BA9 10B,卫星名称,首字符在前,最多9个英文,最后一个为'\0'
//
//
Expand Down Expand Up @@ -38,6 +38,20 @@ void uint16_to_uint8_array(uint16_t value, uint8_t array[2]) {
void INIT_DOPPLER_DATA() {
memset(&satellite, 0, sizeof(satellite));
EEPROM_ReadBuffer(0x02BA0, &satellite, sizeof(satellite));
if (satellite.name[9] != 0 ||
!(satellite.name[0] >= 32 && satellite.name[0] <= 126)
) {
DOPPLER_FLAG = 0;
return;
}

for (int i = strlen(satellite.name); i < 10; i++)
if (satellite.name[i] != 0) {
DOPPLER_FLAG = 0;
return;
}


}

// 判断是否是闰年
Expand Down Expand Up @@ -74,14 +88,14 @@ int32_t UNIX_TIME(uint8_t time2[6]) {

void READ_DATA(int32_t time_diff, int32_t time_diff1) {
int32_t n = -time_diff;
if (time_diff <= 0 && time_diff1>=0)//正在过境
if (time_diff <= 0 && time_diff1 >= 0)//正在过境
{

if ((n & 0x01) != 0)return;
n = n >> 1;
} else n = 0;

EEPROM_ReadBuffer(0x1E200 + (n << 3), &satellite_data, sizeof (satellite_data));
EEPROM_ReadBuffer(0x1E200 + (n << 3), &satellite_data, sizeof(satellite_data));

// AZ(-180~180,两位浮点,度)2B,EI(-180~180,两位浮点,度)2B,上行频率/10(正整数hz)4B、下行频率/10(正整数hz)4B、距离(两位浮点,km)3B:
// 第1B~2B:AZ的数字部分,只有正,低位在前高位在后,
Expand Down
3 changes: 2 additions & 1 deletion app/doppler.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef _DOPPLER_
#define _DOPPLER_
#include "stdint.h"
#include "stdbool.h"
struct satellite_t
{
char name[10];
Expand All @@ -23,6 +24,6 @@ void READ_DATA(int32_t time_diff, int32_t time_diff1) ;
void INIT_DOPPLER_DATA();
int32_t UNIX_TIME(uint8_t time2[6]) ;
extern struct satellite_d satellite_data;

extern bool DOPPLER_FLAG;
extern struct satellite_t satellite;
#endif
20 changes: 20 additions & 0 deletions app/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -647,9 +647,29 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
}
#ifdef ENABLE_DOPPLER
if (Direction==-1) {

if (!DOPPLER_FLAG) {
BACKLIGHT_TurnOn();
UI_DisplayClear();
UI_PrintStringSmall("\xCE\xC0\xD0\xC7\xCA\xFD\xBE\xDD\xCA\xA7\xD0\xA7!", 0, 127, 0);
UI_PrintStringSmall("\xD0\xB4\xC8\xEB\xCA\xFD\xBE\xDD:", 0, 127, 2);
UI_PrintStringSmall("k5.vicicode.com", 0, 127, 4);
ST7565_BlitFullScreen();
uint8_t cnt_i = 200;
while (cnt_i|| (KEYBOARD_Poll() != KEY_INVALID)) {

if (KEYBOARD_Poll() == KEY_EXIT) {
break;
}
SYSTEM_DelayMs(7);
cnt_i--;
}

}else{
DOPPLER_MODE=1;
APP_RunSpectrum();
gRequestDisplayScreen = DISPLAY_MAIN;
}
}
#endif
return;
Expand Down
Loading

0 comments on commit eda1812

Please sign in to comment.