diff --git a/Makefile b/Makefile index f560083..b3a9766 100644 --- a/Makefile +++ b/Makefile @@ -70,11 +70,13 @@ ENABLE_MESSENGER_DELIVERY_NOTIFICATION = 0 ENABLE_MESSENGER_NOTIFICATION = 0 ENABLE_4732 =0 ENABLE_4732SSB =0 - +ENABLE_RTC =1 ENABLE_DOPPLER =1 ENABLE_TLE = 1 +ENABLE_PIC =1 + ############################################################# -PACKED_FILE_SUFFIX = LOSEHU01D +PACKED_FILE_SUFFIX = LOSEHU02 ifeq ($(ENABLE_PINYIN),1) ENABLE_CHINESE_FULL=4 endif @@ -82,8 +84,14 @@ endif ifeq ($(ENABLE_DOPPLER),1) ENABLE_SPECTRUM=1 endif - - +ifeq ($(ENABLE_RTC),1) + PACKED_FILE_SUFFIX := $(PACKED_FILE_SUFFIX)R + $(info R) +endif +ifeq ($(ENABLE_TLE),1) + PACKED_FILE_SUFFIX := $(PACKED_FILE_SUFFIX)D + $(info D) +endif ifeq ($(ENABLE_4732),1) ENABLE_FMRADIO=0 PACKED_FILE_SUFFIX := $(PACKED_FILE_SUFFIX)S @@ -150,7 +158,9 @@ endif ifeq ($(ENABLE_DOPPLER),1) OBJS += driver/rtc.o OBJS += app/doppler.o - +endif +ifeq ($(ENABLE_RTC),1) + OBJS += tle/DS3231.o endif ifeq ($(ENABLE_TLE),1) OBJS += tle/eci.o @@ -357,6 +367,9 @@ endif ifeq ($(ENABLE_SPECTRUM),1) CFLAGS += -DENABLE_SPECTRUM endif +ifeq ($(ENABLE_PIC),1) +CFLAGS += -DENABLE_PIC +endif ifeq ($(ENABLE_MDC1200),1) CFLAGS += -DENABLE_MDC1200 endif @@ -391,6 +404,9 @@ endif ifeq ($(ENABLE_DOPPLER),1) CFLAGS += -DENABLE_DOPPLER endif +ifeq ($(ENABLE_RTC),1) + CFLAGS += -DENABLE_RTC +endif ifeq ($(ENABLE_TLE),1) CFLAGS += -DENABLE_TLE @@ -594,7 +610,9 @@ endif full: $(RM) *.bin - $(MAKE) build ENABLE_CHINESE_FULL=4 ENABLE_DOPPLER=1 ENABLE_TIMER=1 + $(MAKE) build ENABLE_CHINESE_FULL=4 ENABLE_DOPPLER=1 ENABLE_TIMER=1 ENABLE_RTC=0 ENABLE_PIC=1 + #$(MAKE) build ENABLE_CHINESE_FULL=4 ENABLE_DOPPLER=1 ENABLE_TIMER=1 ENABLE_RTC=1 ENABLE_PIC=1 + test: $(RM) *.bin diff --git a/main.c b/main.c index 849343a..bfda52e 100644 --- a/main.c +++ b/main.c @@ -104,8 +104,10 @@ void Main(void) { | SYSCON_DEV_CLK_GATE_AES_BITS_ENABLE | SYSCON_DEV_CLK_GATE_PWM_PLUS0_BITS_ENABLE | (1 << 12) - +#ifndef ENABLE_RTC | (1 << 22) +#endif + ; SYSTICK_Init(); @@ -121,8 +123,11 @@ void Main(void) { SETTINGS_LoadCalibration(); +#ifndef ENABLE_RTC RTC_INIT(); +#endif + // INIT_DOPPLER_DATA(); // RADIO_ConfigureChannel(0, VFO_CONFIGURE_RELOAD); // RADIO_ConfigureChannel(1, VFO_CONFIGURE_RELOAD); diff --git a/tle/DS3231.c b/tle/DS3231.c new file mode 100644 index 0000000..75e1314 --- /dev/null +++ b/tle/DS3231.c @@ -0,0 +1,155 @@ + +#include +#include +#include "driver/eeprom.h" +#include "driver/i2c.h" +#include "driver/system.h" +#include "assert.h" +#include +#include +#include +#include "app/action.h" +#include "app/app.h" +#include "app/chFrScanner.h" +#include "app/dtmf.h" +#include "driver/uart.h" +#include "app/generic.h" +#include "app/main.h" +#include "app/menu.h" +#include "app/scanner.h" + + +#include "ARMCM0.h" +#include "audio.h" +#include "board.h" +#include "bsp/dp32g030/gpio.h" +#include "driver/backlight.h" +#include "driver/bk4819.h" +#include "driver/gpio.h" +#include "driver/keyboard.h" +#include "driver/st7565.h" +#include "driver/system.h" +#include "am_fix.h" +#include "bsp/dp32g030/rtc.h" +#include "frequencies.h" +#include "functions.h" +#include "helper/battery.h" +#include "misc.h" +#include "radio.h" +#include "settings.h" +#include "ui/battery.h" +#include "ui/inputbox.h" +#include "ui/main.h" +#include "ui/menu.h" +#include "ui/status.h" +#include "ui/ui.h" +#include "tle/DS3231.h" +//存放初始时间,数组内容顺序对应:秒、分、时、星期、日期、月、年。 +// uint8_t DS3231_TimeConfig[7] = {00,50,23,4,29,2,24}; +//存放实时时间 +//存放设置闹钟信息 + +#define I2C_StartCondition I2C_Start +#define I2C_Send I2C_Write +#define I2C_StopCondition I2C_Stop + +#define I2C_Receive I2C_Read + +/** + * @brief DS3231写单字节 + * @param WordAddress DS3231要写入的寄存器地址 + * @param byte 要写入的字节 +*/ +void DS3231_Write(uint8_t WordAddress,uint8_t byte) +{ + __disable_irq(); + + I2C_StartCondition(); + I2C_Send(DS3231_I2C_ADDRESS_WR); + I2C_Send(WordAddress); + I2C_Send(byte); + I2C_StopCondition(); + __enable_irq(); + +} +/** + * @brief DS3231读单字节 + * @param WordAddress DS3231要读取的寄存器地址 + * @retval 接收到的字节 +*/ +uint8_t DS3231_Read(uint8_t WordAddress) +{ + __disable_irq(); + + uint8_t byte; + + I2C_StartCondition(); //起始信号 + I2C_Send(DS3231_I2C_ADDRESS_WR); //发从机地址写 + I2C_Send(WordAddress); //发目标字地址 + I2C_StartCondition(); //再次起始信号 + I2C_Send(DS3231_I2C_ADDRESS_RD); //发从机地址读 + byte = I2C_Receive(1); //接收数据 + I2C_StopCondition(); //停止信号 + return byte; + __enable_irq(); + +} + +/** + * @brief DS3231设置RTC时间信息,可在数组 DS3231_TimeConfig[] 中配置时间信息 +*/ +void DS3231_SetTime(uint8_t times_set[6]) +{ + __disable_irq(); + + // uint8_t i,temp_array[7]; + //存放初始时间,数组内容顺序对应:秒、分、时、星期、日期、月、年。 + + uint8_t temp_array[7] = {times_set[5],times_set[4],times_set[3],4,times_set[2],times_set[1],times_set[0]}; + + for (uint8_t i = 0; i < 7; i++) //将初始时间数组引用到临时数组,循环将数组中内容转换为BCD码 + temp_array[i] = (temp_array[i] / 10*16) + (temp_array[i] % 10); + + I2C_StartCondition(); + I2C_Send(DS3231_I2C_ADDRESS_WR); + I2C_Send(DS3231_ADDRESS_SECOND); //写秒寄存器地址 + for (uint8_t i = 0; i < 7; i++) //每次数据传送完成后DS3231内部寄存器将自动递增 + I2C_Send(temp_array[i]); + // I2C_WriteBuffer(temp_array,7); + I2C_StopCondition(); + __enable_irq(); + +} + +/** + * @brief DS3231获取当前时钟信息并存储到数组 DS3231_RTC[] +*/ +void DS3231_GetTime(uint8_t get_time[6]) +{ + __disable_irq(); + + uint8_t DS3231_RTC[7]; + I2C_StartCondition(); + I2C_Send(DS3231_I2C_ADDRESS_WR); + I2C_Send(DS3231_ADDRESS_SECOND); + I2C_StartCondition(); + I2C_Send(DS3231_I2C_ADDRESS_RD); + + // I2C_ReadBuffer(DS3231_RTC, 7); + + + for (uint8_t i = 0; i < 7; i++) //每次数据传送完成后DS3231内部寄存器将自动递增 + //接收最后一个字节主机必须发送非应答 + DS3231_RTC[i] = (i < 6) ? I2C_Receive(0) : I2C_Receive(1); + I2C_StopCondition(); + for (uint8_t i = 0; i < 7; i++) //数组中内容转为DEC码 + DS3231_RTC[i] = (DS3231_RTC[i] / 16*10) + (DS3231_RTC[i] % 16); + get_time[0] = DS3231_RTC[6]; + get_time[1] = DS3231_RTC[5]; + get_time[2] = DS3231_RTC[4]; + get_time[3] = DS3231_RTC[2]; + get_time[4] = DS3231_RTC[1]; + get_time[5] = DS3231_RTC[0]; + __enable_irq(); + +} \ No newline at end of file diff --git a/tle/DS3231.h b/tle/DS3231.h new file mode 100644 index 0000000..354de24 --- /dev/null +++ b/tle/DS3231.h @@ -0,0 +1,31 @@ +// +// Created by losehu on 2025/2/10. +// + +#ifndef DS3231_H +#define DS3231_H +#include + +#define DS3231_I2C_ADDRESS_WR 0xD0 +#define DS3231_I2C_ADDRESS_RD 0xD1 +//寄存器宏定义 +#define DS3231_ADDRESS_SECOND 0x00 +#define DS3231_ADDRESS_MINUTE 0x01 +#define DS3231_ADDRESS_HOUR 0x02 +#define DS3231_ADDRESS_DAY 0x03 +#define DS3231_ADDRESS_DATE 0x04 +#define DS3231_ADDRESS_MOUTH 0x05 +#define DS3231_ADDRESS_YEAR 0x06 +#define DS3231_ADDRESS_A1_SECOND 0x07 +#define DS3231_ADDRESS_A1_MINUTE 0x08 +#define DS3231_ADDRESS_A1_HOUR 0x09 +#define DS3231_ADDRESS_A1_DAY 0x0A +#define DS3231_ADDRESS_A2_MINUTE 0x0B +#define DS3231_ADDRESS_A2_HOUR 0x0C +#define DS3231_ADDRESS_A2_DAY 0x0D +#define DS3231_ADDRESS_CONTROL 0x0E +#define DS3231_ADDRESS_STATUS 0x0F +void DS3231_GetTime(uint8_t get_time[6]); +void DS3231_SetTime(uint8_t times_set[6]); + +#endif //DS3231_H diff --git a/tle/tle.c b/tle/tle.c index a671253..0ad4d58 100644 --- a/tle/tle.c +++ b/tle/tle.c @@ -75,34 +75,39 @@ #include #include "tle/eci.h" #include "ui/main.h" +#ifdef ENABLE_RTC +void DS3231Handler(void); +#include "tle/DS3231.h" +#endif char *bwOptions[] = {" 25k", "12.5k", "6.25k"}; uint32_t currentFreq; -uint8_t DOPPLER_FLASH=0; -uint8_t is_PTT=0; -uint8_t off_PTT=0; -uint8_t ENABLE_BTC=1; -#define ENABLE_PIC +uint8_t DOPPLER_FLASH = 0; +uint8_t is_PTT = 0; +uint8_t off_PTT = 0; +uint8_t ENABLE_BTC = 1; sat_parm sat_get; -uint8_t local_dot_flag=0; +uint8_t local_dot_flag = 0; + typedef enum { SELECT = 1, SATE = 2, TIME = 3, - LOCAL=4, - PIC=5 + LOCAL = 4, + PIC = 5 } Mode; + Mode before_mode; -uint8_t local_selected=1; -uint8_t local_inflag=0; -uint8_t BACK_ON=1; -uint8_t switch_mode=0; -Mode mode=SELECT; +uint8_t local_selected = 1; +uint8_t local_inflag = 0; +uint8_t BACK_ON = 1; +uint8_t switch_mode = 0; +Mode mode = SELECT; satlist sate_info; look_result look; lat_lon sub_point; -lat_lon observer = { -0.1234567890123456789, 5.1234567890123456789, -50.1234567890123456789 }; -uint8_t now_menu=1; +lat_lon observer = {-0.1234567890123456789, 5.1234567890123456789, -50.1234567890123456789}; +uint8_t now_menu = 1; const uint8_t BITMAP_ARRAY_DOWN[5] = { @@ -122,7 +127,7 @@ const uint8_t BITMAP_ARRAY_UP[5] = }; const uint8_t BITMAP_ARRAY_EMPTY_RIGHT[7] = { -// 0b00000000, + // 0b00000000, 0b01111111, 0b01000001, 0b00100010, @@ -133,7 +138,7 @@ const uint8_t BITMAP_ARRAY_EMPTY_RIGHT[7] = }; const uint8_t BITMAP_ARRAY_RIGHT[7] = { -// 0b00000000, + // 0b00000000, 0b01111111, 0b01111111, 0b00111110, @@ -144,7 +149,7 @@ const uint8_t BITMAP_ARRAY_RIGHT[7] = }; const uint8_t BITMAP_ARRAY_LEFT[7] = { -// 0b00000000, + // 0b00000000, 0b00001000, 0b00011100, 0b00011100, @@ -177,7 +182,7 @@ vec vec_sub(vec a, vec b) { // 计算多普勒频移 uint32_t doppler_shift(double f, vec sat_pos, vec sat_vel, vec obs_pos, uint8_t is_uplink) { - vec los = vec_sub(sat_pos, obs_pos); // 视线方向向量 (Line of Sight) + vec los = vec_sub(sat_pos, obs_pos); // 视线方向向量 (Line of Sight) double los_mag = sqrt(dot(los, los)); // 视线向量模长 vec los_unit = {los.x / los_mag, los.y / los_mag, los.z / los_mag}; // 归一化 @@ -190,21 +195,22 @@ uint32_t doppler_shift(double f, vec sat_pos, vec sat_vel, vec obs_pos, uint8_t // 下行频率:卫星接近地面时频率减小,远离地面时频率增大 f_shifted = f * (C - vr) / C; // 下行频率,卫星远离地面时 vr > 0,频率上升 } - return (uint32_t)round(f_shifted); + return (uint32_t) round(f_shifted); } -uint8_t cal_sat(char line0[25],char line1[70],char line2[70], lat_lon observer,look_result *look,lat_lon *sub_point,uint8_t my_time[6]) -{ - tle_data data; // 直接在栈上创建一个tle_data +uint8_t cal_sat(char line0[25], char line1[70], char line2[70], lat_lon observer, look_result *look, lat_lon *sub_point, + uint8_t my_time[6]) { + tle_data data; // 直接在栈上创建一个tle_data - if (tle_parse(line0, line1, line2, &data) == 0) // 修改为传递指�? + if (tle_parse(line0, line1, line2, &data) == 0) // 修改为传递指�? return 0; - jd target = to_jd(my_time[0] + 2000, my_time[1],my_time[2], my_time[3], my_time[4], my_time[5] ); + jd target = to_jd(my_time[0] + 2000, my_time[1], my_time[2], my_time[3], my_time[4], my_time[5]); *look = eci_to_look(&data, observer, target); *sub_point = eci_to_lat_lon(&data, target); - sub_point->distance= sqrt((look->observer_eci.x-sub_point->sate_eci.x)*(look->observer_eci.x-sub_point->sate_eci.x) \ - + (look->observer_eci.y-sub_point->sate_eci.y)*(look->observer_eci.y-sub_point->sate_eci.y) \ - + (look->observer_eci.z-sub_point->sate_eci.z)*(look->observer_eci.z-sub_point->sate_eci.z) ); + sub_point->distance = sqrt( + (look->observer_eci.x - sub_point->sate_eci.x) * (look->observer_eci.x - sub_point->sate_eci.x) + + (look->observer_eci.y - sub_point->sate_eci.y) * (look->observer_eci.y - sub_point->sate_eci.y) + + (look->observer_eci.z - sub_point->sate_eci.z) * (look->observer_eci.z - sub_point->sate_eci.z)); return 1; } @@ -219,7 +225,7 @@ static int parse_title(tle_data *data, const char *title) { len -= 3; data->title_len = len; - substr(title, 2, len,data->title); + substr(title, 2, len, data->title); if (data->title == NULL) { return 0; } @@ -250,7 +256,7 @@ static int parse_line1(tle_data *data, const char *line1) { /* sat_num */ char sat_num_str[8]; - substr(line1, 2, 5,sat_num_str); + substr(line1, 2, 5, sat_num_str); if (strl(sat_num_str, (long *) &data->sat_num) == 0) { @@ -263,11 +269,11 @@ static int parse_line1(tle_data *data, const char *line1) { data->class = line1[7]; /* launch_yr */ - substr(line1, 9, 2,data->launch_yr ); + substr(line1, 9, 2, data->launch_yr); /* launch_num */ - char launch_num_str[5] ; - substr(line1, 11, 3,launch_num_str); + char launch_num_str[5]; + substr(line1, 11, 3, launch_num_str); if (strl(launch_num_str, (long *) &data->launch_num) == 0) { @@ -278,21 +284,21 @@ static int parse_line1(tle_data *data, const char *line1) { //free(launch_num_str); /* launch_piece */ - substr(line1, 14, 3, data->launch_piece ); + substr(line1, 14, 3, data->launch_piece); if (data->launch_piece == NULL) { return 0; } data->launch_piece_len = (unsigned char) strlen(data->launch_piece); /* epoch_yr */ - substr(line1, 18, 2,data->epoch_yr); + substr(line1, 18, 2, data->epoch_yr); if (data->epoch_yr == NULL) { return 0; } /* epoch_day */ char epoch_day_str[20]; - substr(line1, 20, 12,epoch_day_str); + substr(line1, 20, 12, epoch_day_str); if (epoch_day_str == NULL) { return 0; } @@ -306,7 +312,7 @@ static int parse_line1(tle_data *data, const char *line1) { /* d_mean_motion */ char d_mean_motion_str[20]; - substr(line1, 33, 10,d_mean_motion_str); + substr(line1, 33, 10, d_mean_motion_str); if (strd(d_mean_motion_str, &data->d_mean_motion) == 0) { //free(d_mean_motion_str); @@ -317,8 +323,8 @@ static int parse_line1(tle_data *data, const char *line1) { /* dd_mean_motion */ double dd_mean_motion_mul = 0; - char dd_mean_motion_mul_str[20] ; - substr(line1, 44, 6,dd_mean_motion_mul_str); + char dd_mean_motion_mul_str[20]; + substr(line1, 44, 6, dd_mean_motion_mul_str); if (dd_mean_motion_mul_str == NULL) { return 0; } @@ -332,8 +338,8 @@ static int parse_line1(tle_data *data, const char *line1) { dd_mean_motion_mul /= 100000; int dd_mean_motion_exp = 0; - char dd_mean_motion_exp_str[20] ; - substr(line1, 50, 2,dd_mean_motion_exp_str); + char dd_mean_motion_exp_str[20]; + substr(line1, 50, 2, dd_mean_motion_exp_str); if (dd_mean_motion_exp_str == NULL) { return 0; } @@ -348,8 +354,8 @@ static int parse_line1(tle_data *data, const char *line1) { /* drag */ double drag_mul = 0; - char drag_mul_str[20] ; - substr(line1, 53, 6,drag_mul_str); + char drag_mul_str[20]; + substr(line1, 53, 6, drag_mul_str); if (drag_mul_str == NULL) { return 0; } @@ -363,8 +369,8 @@ static int parse_line1(tle_data *data, const char *line1) { drag_mul /= 100000; int drag_exp = 0; - char drag_exp_str[20] ; - substr(line1, 59, 2,drag_exp_str); + char drag_exp_str[20]; + substr(line1, 59, 2, drag_exp_str); if (drag_exp_str == NULL) { return 0; } @@ -381,8 +387,8 @@ static int parse_line1(tle_data *data, const char *line1) { data->ephemeris = (unsigned char) line1[62]; /* element_num */ - char element_num_str[20] ; - substr(line1, 64, 4,element_num_str); + char element_num_str[20]; + substr(line1, 64, 4, element_num_str); if (element_num_str == NULL) { return 0; } @@ -408,7 +414,7 @@ static int parse_line2(tle_data *data, const char *line2) { /* inclination */ char inclination_str[20]; - substr(line2, 8, 8,inclination_str); + substr(line2, 8, 8, inclination_str); if (inclination_str == NULL) { return 0; } @@ -421,8 +427,8 @@ static int parse_line2(tle_data *data, const char *line2) { //free(inclination_str); /* r_node_ascension */ - char r_node_ascension_str[20] ; - substr(line2, 17, 8,r_node_ascension_str); + char r_node_ascension_str[20]; + substr(line2, 17, 8, r_node_ascension_str); if (r_node_ascension_str == NULL) { return 0; } @@ -436,8 +442,8 @@ static int parse_line2(tle_data *data, const char *line2) { /* eccentricity */ double eccentricity = 0; - char eccentricity_str[20] ; - substr(line2, 26, 7,eccentricity_str); + char eccentricity_str[20]; + substr(line2, 26, 7, eccentricity_str); if (eccentricity_str == NULL) { return 0; } @@ -451,8 +457,8 @@ static int parse_line2(tle_data *data, const char *line2) { data->eccentricity = eccentricity /= 10000000; /* perigee_arg */ - char perigee_arg_str[20] ; - substr(line2, 34, 8,perigee_arg_str); + char perigee_arg_str[20]; + substr(line2, 34, 8, perigee_arg_str); if (perigee_arg_str == NULL) { return 0; } @@ -465,8 +471,8 @@ static int parse_line2(tle_data *data, const char *line2) { //free(perigee_arg_str); /* mean_anomaly */ - char mean_anomaly_str[20] ; - substr(line2, 43, 8,mean_anomaly_str); + char mean_anomaly_str[20]; + substr(line2, 43, 8, mean_anomaly_str); if (mean_anomaly_str == NULL) { return 0; } @@ -479,8 +485,8 @@ static int parse_line2(tle_data *data, const char *line2) { //free(mean_anomaly_str); /* rev_per_day */ - char rev_per_day_str[20] ; - substr(line2, 52, 11,rev_per_day_str); + char rev_per_day_str[20]; + substr(line2, 52, 11, rev_per_day_str); if (rev_per_day_str == NULL) { return 0; } @@ -494,7 +500,7 @@ static int parse_line2(tle_data *data, const char *line2) { /* rev_num */ char rev_num_str[20]; - substr(line2, 63, 5,rev_num_str); + substr(line2, 63, 5, rev_num_str); if (rev_num_str == NULL) { return 0; } @@ -510,19 +516,19 @@ static int parse_line2(tle_data *data, const char *line2) { } int tle_parse(const char *title, const char *line1, const char *line2, tle_data *data) { -// if (parse_title(data, title) == 0) { -// return 0; // 解析失败 -// } + // if (parse_title(data, title) == 0) { + // return 0; // 解析失败 + // } if (parse_line1(data, line1) == 0) { - return 0; // 解析失败 + return 0; // 解析失败 } if (parse_line2(data, line2) == 0) { - return 0; // 解析失败 + return 0; // 解析失败 } - return 1; // 成功解析 + return 1; // 成功解析 } void tle_print(FILE *stream, tle_data *data) { @@ -549,8 +555,6 @@ void tle_print(FILE *stream, tle_data *data) { } - - void tle_free(tle_data *data) { //free(data->title); //free(data->launch_yr); @@ -560,39 +564,37 @@ void tle_free(tle_data *data) { } -void draw_horizontal_line(int x,int y0, int y1) { +void draw_horizontal_line(int x, int y0, int y1) { for (int y = y0; y <= y1; y++) { - if(x>=0 &&y >=0 &&x<128 &&y<64) + if (x >= 0 && y >= 0 && x < 128 && y < 64) // DrawPoint(x, y); - if(y<8) UI_DrawPixelBuffer(&gStatusLine, x, y, look.altitude>=0); - else UI_DrawPixelBuffer(gFrameBuffer, x, y-8, look.altitude>=0); - + if (y < 8) UI_DrawPixelBuffer(&gStatusLine, x, y, look.altitude >= 0); + else UI_DrawPixelBuffer(gFrameBuffer, x, y - 8, look.altitude >= 0); } } -void fill_circle(uint8_t center_x,uint8_t center_y) -{ - static bool drawed_line=false; - float r=5; - float start_x=center_x-r; - float start_y=center_y; +void fill_circle(uint8_t center_x, uint8_t center_y) { + static bool drawed_line = false; + float r = 5; - float num_point=1; - for(float i=-r; i<=r; i+=num_point) - { - if(start_x+(r/4)>i+start_x+r || i+start_x+r>start_x+2*r-r/4) - num_point=0.1; + float start_x = center_x - r; + float start_y = center_y; + + float num_point = 1; + for (float i = -r; i <= r; i += num_point) { + if (start_x + (r / 4) > i + start_x + r || i + start_x + r > start_x + 2 * r - r / 4) + num_point = 0.1; else - num_point=1; + num_point = 1; //y=sqrt(30*30-x*x) - float y=sqrt(r*r-i*i); - draw_horizontal_line(round(i+start_x+r),round(start_y-y*2/3), round(start_y+y*2/3)); - DrawPoint(round(i+start_x+r), round(start_y+y*2/3)); - DrawPoint(round(i+start_x+r), round(start_y-y*2/3)); - + float y = sqrt(r * r - i * i); + draw_horizontal_line(round(i + start_x + r), round(start_y - y * 2 / 3), round(start_y + y * 2 / 3)); + DrawPoint(round(i + start_x + r), round(start_y + y * 2 / 3)); + DrawPoint(round(i + start_x + r), round(start_y - y * 2 / 3)); } } + //const char *line0 = "ISS (ZARYA)"; //const char *line1 = "1 25544U 98067A 25026.23381182 .00024447 00000+0 42619-3 0 9998"; //const char *line2 = "2 25544 51.6395 290.1622 0002159 133.7357 10.9595 15.50580823493146"; @@ -600,82 +602,71 @@ void fill_circle(uint8_t center_x,uint8_t center_y) //look_result look;lat_lon sub_point; //lat_lon observer = { 50, 50, 50 }; //cal_sat(line0,line1,line2,observer,&look,&sub_point,my_time); -void drawcircle(uint8_t center_x,uint8_t center_y,uint8_t r) -{ - uint8_t start_x=center_x-r; - uint8_t start_y=center_y; +void drawcircle(uint8_t center_x, uint8_t center_y, uint8_t r) { + uint8_t start_x = center_x - r; + uint8_t start_y = center_y; // uint8_t r=45; - float num_point=1; - for(float i=-r; i<=r; i+=num_point) - { - if(start_x+(r/4)>i+start_x+r || i+start_x+r>start_x+2*r-r/4) - num_point=0.1; + float num_point = 1; + for (float i = -r; i <= r; i += num_point) { + if (start_x + (r / 4) > i + start_x + r || i + start_x + r > start_x + 2 * r - r / 4) + num_point = 0.1; else - num_point=1; + num_point = 1; //y=sqrt(30*30-x*x) - float y=sqrt(r*r-i*i); - DrawPoint(i+start_x+r, round( start_y+y*2/3)); - DrawPoint(i+start_x+r, round( start_y-y*2/3)); - + float y = sqrt(r * r - i * i); + DrawPoint(i + start_x + r, round(start_y + y * 2 / 3)); + DrawPoint(i + start_x + r, round(start_y - y * 2 / 3)); } - for(int i=0; i<=r; i++) - { - DrawPoint(start_x+i+r, start_y); - DrawPoint(start_x-i+r, start_y); - + for (int i = 0; i <= r; i++) { + DrawPoint(start_x + i + r, start_y); + DrawPoint(start_x - i + r, start_y); } - for(int i=0; i<=r; i++) - { - DrawPoint(start_x+r, start_y-(i)*2/3); - DrawPoint(start_x+r, start_y+(i)*2/3); + for (int i = 0; i <= r; i++) { + DrawPoint(start_x + r, start_y - (i) * 2 / 3); + DrawPoint(start_x + r, start_y + (i) * 2 / 3); } - } - - - -void Read_TLE(uint8_t num,sat_parm *now_sat) -{ - uint32_t base_add =0x1E200+num*160; +void Read_TLE(uint8_t num, sat_parm *now_sat) { + uint32_t base_add = 0x1E200 + num * 160; char c[160]; - EEPROM_ReadBuffer(base_add,c,160) ; - - - memcpy(now_sat->name,c,9);//卫星名字9B不包含结束0 - memcpy( now_sat->line1,c+9,69);//卫星TLE第一行 69B不包含结束0 - memcpy(now_sat->line2,c+9+69,69);//卫星TLE第二行 69B不包含结束0 - now_sat->TX_TONE=c[9+69+69]+(c[9+69+69+1]<<8);//上行发射亚音 uint16,低位在前高位在后 - now_sat->RX_TONE=c[9+69+69+2]+(c[9+69+69+3]<<8);//下行接受亚音 uint16,低位在前高位在后 - now_sat->TX_FREQ=c[9+69+69+4]+(c[9+69+69+5]<<8)+(c[9+69+69+6]<<16)+(c[9+69+69+7]<<24);// 上行发射频率/10 uint32,低位在前高位在后 - now_sat->RX_FREQ=c[9+69+69+8]+(c[9+69+69+9]<<8)+(c[9+69+69+10]<<16)+(c[9+69+69+11]<<24);// 下行接收频率/10 uint32,低位在前高位在后 - now_sat->line2[69]=0; - now_sat->line1[69]=0; - now_sat->name[9]=0; + EEPROM_ReadBuffer(base_add, c, 160); + + + memcpy(now_sat->name, c, 9); //卫星名字9B不包含结束0 + memcpy(now_sat->line1, c + 9, 69); //卫星TLE第一行 69B不包含结束0 + memcpy(now_sat->line2, c + 9 + 69, 69); //卫星TLE第二行 69B不包含结束0 + now_sat->TX_TONE = c[9 + 69 + 69] + (c[9 + 69 + 69 + 1] << 8); //上行发射亚音 uint16,低位在前高位在后 + now_sat->RX_TONE = c[9 + 69 + 69 + 2] + (c[9 + 69 + 69 + 3] << 8); //下行接受亚音 uint16,低位在前高位在后 + now_sat->TX_FREQ = c[9 + 69 + 69 + 4] + (c[9 + 69 + 69 + 5] << 8) + (c[9 + 69 + 69 + 6] << 16) + ( + c[9 + 69 + 69 + 7] << 24); // 上行发射频率/10 uint32,低位在前高位在后 + now_sat->RX_FREQ = c[9 + 69 + 69 + 8] + (c[9 + 69 + 69 + 9] << 8) + (c[9 + 69 + 69 + 10] << 16) + ( + c[9 + 69 + 69 + 11] << 24); // 下行接收频率/10 uint32,低位在前高位在后 + now_sat->line2[69] = 0; + now_sat->line1[69] = 0; + now_sat->name[9] = 0; } -uint8_t tle_check() -{ - - sate_info.num=0; +uint8_t tle_check() { + sate_info.num = 0; sat_parm now_sat; - int cnt_num=0; - for(int i=0; i < 45; i++) - { - cnt_num=i; + int cnt_num = 0; + for (int i = 0; i < 45; i++) { + cnt_num = i; - Read_TLE(i,&now_sat); + Read_TLE(i, &now_sat); tle_data data; - uint8_t judge=tle_parse( now_sat.name, now_sat.line1, now_sat.line2, &data); + uint8_t judge = tle_parse(now_sat.name, now_sat.line1, now_sat.line2, &data); - if(now_sat.TX_TONE>2541 || now_sat.RX_TONE>2541 || now_sat.RX_FREQ==0||now_sat.TX_FREQ>50000000 || now_sat.RX_FREQ>50000000) - judge=0; - if(judge) { - sate_info.list[sate_info.num]=i; + if (now_sat.TX_TONE > 2541 || now_sat.RX_TONE > 2541 || now_sat.RX_FREQ == 0 || now_sat.TX_FREQ > 50000000 || + now_sat.RX_FREQ > 50000000) + judge = 0; + if (judge) { + sate_info.list[sate_info.num] = i; sate_info.num++; } } @@ -683,26 +674,30 @@ uint8_t tle_check() } void SELECT_DISPLAY() { - char str[22] = {0}; for (int i = 0; i < NUM_PER_PAGE; ++i) { uint8_t show_num = ((now_menu - 1) / NUM_PER_PAGE) * NUM_PER_PAGE + 1 + i; if (show_num > sate_info.num) break; char str1[14]; - EEPROM_ReadBuffer(0x1e200 + 160 * (sate_info.list[show_num- 1] ), str1, 9); + EEPROM_ReadBuffer(0x1e200 + 160 * (sate_info.list[show_num - 1]), str1, 9); str1[9] = 0; sprintf(str, "%02d.%s", show_num, str1); UI_PrintStringSmall(str, 8, 0, i); } - if ((now_menu - 1) / NUM_PER_PAGE * NUM_PER_PAGE + 1 < sate_info.num) memcpy(&gStatusLine[110], BITMAP_ARRAY_DOWN, 5); + if ((now_menu - 1) / NUM_PER_PAGE * NUM_PER_PAGE + 1 < sate_info.num) + memcpy( + &gStatusLine[110], BITMAP_ARRAY_DOWN, 5); if ((now_menu - 1) / NUM_PER_PAGE) memcpy(&gStatusLine[102], BITMAP_ARRAY_UP, 5); - UI_PrintStringSmallBuffer("LoseHu DSF 0.1", gStatusLine); +#ifdef ENABLE_RTC + UI_PrintStringSmallBuffer("LoseHu DSF 0.2R", gStatusLine); +#else + UI_PrintStringSmallBuffer("LoseHu DSF 0.2", gStatusLine); +#endif memcpy(&gFrameBuffer[(now_menu - 1) % NUM_PER_PAGE][0], BITMAP_ARRAY_RIGHT, sizeof(BITMAP_ARRAY_RIGHT)); memcpy(&gFrameBuffer[(now_menu - 1) % NUM_PER_PAGE][120], BITMAP_ARRAY_LEFT, sizeof(BITMAP_ARRAY_LEFT)); sprintf(str, "%02d/%02d", now_menu, sate_info.num); UI_PrintStringSmall(str, 0, 0, 6); - } static void UpdateDBMax(bool inc) { @@ -722,35 +717,30 @@ static void UpdateDBMax(bool inc) { SYSTEM_DelayMs(20); } -void SATE_DISPLAY() -{ +void SATE_DISPLAY() { char String[40]; - uint8_t DATA_LINE=26; + uint8_t DATA_LINE = 26; - sprintf(String, "alt:%4d.%02d",(int)trunc(look.altitude),(abs((int)(look.altitude*100)))%100 ); - if (look.altitude<0&&look.altitude>-1&&(abs((int)(look.altitude*100)))%100!=0) String[6]='-'; + sprintf(String, "alt:%4d.%02d", (int) trunc(look.altitude), (abs((int) (look.altitude * 100))) % 100); + if (look.altitude < 0 && look.altitude > -1 && (abs((int) (look.altitude * 100))) % 100 != 0) String[6] = '-'; GUI_DisplaySmallest(String, 82, DATA_LINE + 15, false, true); - sprintf(String, "%d km",(int)sub_point.distance ); - GUI_DisplaySmallest(String, 82+((127-82)-strlen(String)*4)/2, DATA_LINE + 23, false, true); + sprintf(String, "%d km", (int) sub_point.distance); + GUI_DisplaySmallest(String, 82 + ((127 - 82) - strlen(String) * 4) / 2, DATA_LINE + 23, false, true); char SHOW_TIME[6]; - memcpy(SHOW_TIME,my_time,6); - if( ENABLE_BTC) - utcToBeijingTime(SHOW_TIME) ; + memcpy(SHOW_TIME, my_time, 6); + if (ENABLE_BTC) + utcToBeijingTime(SHOW_TIME); - sprintf(String, "20%02d-%02d-%02d %02d:%02d:%02d ", SHOW_TIME[0], SHOW_TIME[1], SHOW_TIME[2], SHOW_TIME[3], SHOW_TIME[4], SHOW_TIME[5]); - if( ENABLE_BTC)String[19]='B'; - else String[19]='U'; - String[20]=0; + sprintf(String, "20%02d-%02d-%02d %02d:%02d:%02d ", SHOW_TIME[0], SHOW_TIME[1], SHOW_TIME[2], SHOW_TIME[3], + SHOW_TIME[4], SHOW_TIME[5]); + if (ENABLE_BTC)String[19] = 'B'; + else String[19] = 'U'; + String[20] = 0; GUI_DisplaySmallest(String, 1, DATA_LINE + 23, false, true); - - - - - // DrawF(fMeasure);//绘制频率 uint8_t METER_PAD_LEFT = 3; uint8_t P_WIDTH = 120; @@ -764,11 +754,11 @@ void SATE_DISPLAY() DBM_X = 6; memset(&gFrameBuffer[2][METER_PAD_LEFT], 0b01000000, P_WIDTH); - for (int i = 0; i <= P_WIDTH; i += 5) { //小刻度 + for (int i = 0; i <= P_WIDTH; i += 5) { + //小刻度 gFrameBuffer[2][i + METER_PAD_LEFT] = 0b01100000; - } - uint8_t x = Rssi2PX(scanInfo.rssi, 0, P_WIDTH);//信号强度 + uint8_t x = Rssi2PX(scanInfo.rssi, 0, P_WIDTH); //信号强度 for (int i = 0; i < x; i++) { if (i % 5) { gFrameBuffer[2][i + METER_PAD_LEFT] |= 0b00001110; @@ -776,14 +766,12 @@ void SATE_DISPLAY() } - - -//S表参数绘制 + //S表参数绘制 int dbm = Rssi2DBm(scanInfo.rssi); uint8_t s = DBm2S(dbm); bool fill = true; - if ((monitorMode || IsPeakOverLevel()) ) { + if ((monitorMode || IsPeakOverLevel())) { memset(gFrameBuffer[2] + DBM_X - 2, 0b11111110, 51); fill = false; } @@ -802,10 +790,9 @@ void SATE_DISPLAY() const uint8_t CELL_WIDTH = 30; uint8_t offset = PAD_LEFT; uint8_t row = 4; - uint8_t SHOW_LINE=4; + uint8_t SHOW_LINE = 4; SHOW_LINE = 3; for (int i = 0, idx = 1; idx <= 4; ++i, ++idx) { - offset = PAD_LEFT + i * CELL_WIDTH; if (menuState == idx) { for (int j = 0; j < CELL_WIDTH; ++j) { @@ -825,9 +812,6 @@ void SATE_DISPLAY() } - - - bool flag = true; if (!isTransmitting) { sprintf(String, "%03u.%05u", sat_get.DOWN_LINK / 100000, sat_get.DOWN_LINK % 100000); @@ -838,7 +822,7 @@ void SATE_DISPLAY() UI_DisplayFrequency(String, 8, 0, false); memset(gFrameBuffer[5], 0x7f, 77); flag = false; - sprintf(String, "DownLink:%4d.%05d", sat_get.DOWN_LINK / 100000,sat_get.DOWN_LINK % 100000); + sprintf(String, "DownLink:%4d.%05d", sat_get.DOWN_LINK / 100000, sat_get.DOWN_LINK % 100000); } GUI_DisplaySmallest(String, 1, DATA_LINE + 15, false, flag); @@ -859,43 +843,79 @@ void SATE_DISPLAY() // DrawPower(); //頻率 +} +extern uint8_t back_point[109][2]; +extern uint8_t num_point[28][2]; +extern uint8_t fill_point[39][2]; -} -void PIC_DISPLAY() -{ +void PIC_DISPLAY() { char String[20]; - drawcircle(40,32,39); - drawcircle(40,32,26); - drawcircle(40,32,13); - float alt=look.altitude; - float ano= look.azimuth; - float r=(90-fabs(alt))*39/90; - - float center_x=40+(r*sin(ano*3.141592653589/180)); - float center_y=32-(r*cos(ano*3.141592653589/180)*2/3); - fill_circle((uint8_t)round(center_x),(uint8_t)round(center_y)); - uint8_t start_text=85; - uint8_t start_num=78; + // drawcircle(40, 32, 39); + // drawcircle(40, 32, 26); + // drawcircle(40, 32, 13); + // uint8_t back_point[428][2]={ + + { + //绘制background + for (int i = 0; i < 109; i++) { + DrawPoint(40 + back_point[i][0] - 26, 32 + (back_point[i][1] - 26)); //右下 + DrawPoint(40 - (back_point[i][0] - 26), 32 + (back_point[i][1] - 26)); //左下 + DrawPoint(40 + back_point[i][0] - 26, 32 - (back_point[i][1] - 26)); //右上 + DrawPoint(40 - (back_point[i][0] - 26), 32 - (back_point[i][1] - 26)); //左上 + } + uint8_t start_x = 40 - 39; + uint8_t start_y = 32; + uint8_t r = 39; + for (int i = 0; i <= r; i++) { + DrawPoint(start_x + i + r, start_y); + DrawPoint(start_x - i + r, start_y); + } + for (int i = 0; i <= r + 2; i++) { + DrawPoint(start_x + r, start_y - (i) * 2 / 3); + DrawPoint(start_x + r, start_y + (i) * 2 / 3); + } + } + float alt = look.altitude; + float ano = look.azimuth; + float r = (90 - fabs(alt)) * 39 / 90; + + float center_x = 40 + (r * sin(ano * 3.141592653589 / 180)); + float center_y = 32 - (r * cos(ano * 3.141592653589 / 180) * 2 / 3); + // fill_circle((uint8_t) round(center_x), (uint8_t) round(center_y)); + + for (int i = 0; i < 28; i++) //绘制卫星 + DrawPoint(num_point[i][0] - 5 + center_x, center_y + num_point[i][1] - 5); + + for (int i = 0; i < 39; i++) { + //填充卫星 + uint8_t x = fill_point[i][0] - 4 + center_x; + uint8_t y = center_y + fill_point[i][1] - 4; + if (x >= 0 && y >= 0 && x < 128 && y < 64) { + if (y < 8) UI_DrawPixelBuffer(&gStatusLine, x, y, look.altitude >= 0); + else UI_DrawPixelBuffer(gFrameBuffer, x, y - 8, look.altitude >= 0); + } + } + + uint8_t start_text = 85; + uint8_t start_num = 78; UI_PrintStringSmall("alt:", start_text, 0, 0); - sprintf(String, "%4d.%02d", (int)trunc(look.altitude),abs((int)(look.altitude*100))%100); - if (look.altitude<0&&look.altitude>-1&&(abs((int)(look.altitude*100)))%100!=0) String[2]='-'; + sprintf(String, "%4d.%02d", (int) trunc(look.altitude), abs((int) (look.altitude * 100)) % 100); + if (look.altitude < 0 && look.altitude > -1 && (abs((int) (look.altitude * 100))) % 100 != 0) String[2] = '-'; UI_PrintStringSmall(String, start_num, 0, 1); UI_PrintStringSmall("azi:", start_text, 0, 2); - sprintf(String, "%4d.%02d", (int)trunc(look.azimuth),abs((int)(look.azimuth*100))%100); - if (look.azimuth<0&&look.azimuth>-1&&abs((int)(look.azimuth*100))%100!=0) String[2]='-'; + sprintf(String, "%4d.%02d", (int) trunc(look.azimuth), abs((int) (look.azimuth * 100)) % 100); + if (look.azimuth < 0 && look.azimuth > -1 && abs((int) (look.azimuth * 100)) % 100 != 0) String[2] = '-'; UI_PrintStringSmall(String, start_num, 0, 3); UI_PrintStringSmall("dis:", start_text, 0, 4); - sprintf(String, "%dkm",(int)sub_point.distance ); + sprintf(String, "%dkm", (int) sub_point.distance); UI_PrintStringSmall(String, start_num, 0, 5); - } - // 计算整数的位数 int countIntegerDigits(int num) { if (num == 0) return 1; // 0 的位数为 1 @@ -906,28 +926,27 @@ int countIntegerDigits(int num) { } return count; } -void Write_LOCAL() -{ - if(observer.lat>=-90&&observer.lat<=90) EEPROM_WriteBuffer(0x2BB0, (uint8_t *)&observer.lat,8); - if(observer.lon>=-180&&observer.lon<=180) EEPROM_WriteBuffer(0x2BB0+8,(uint8_t *)&observer.lon,8); - if(observer.height>=-999999&& observer.height<=999999) EEPROM_WriteBuffer(0x2BB0+16,(uint8_t *)&observer.height,8); +void Write_LOCAL() { + if (observer.lat >= -90 && observer.lat <= 90) EEPROM_WriteBuffer(0x2BB0, (uint8_t *) &observer.lat, 8); + if (observer.lon >= -180 && observer.lon <= 180) EEPROM_WriteBuffer(0x2BB0 + 8, (uint8_t *) &observer.lon, 8); + if (observer.height >= -999999 && observer.height <= 999999) + EEPROM_WriteBuffer( + 0x2BB0 + 16, (uint8_t *) &observer.height, 8); } -void Read_LOCAL() -{ - EEPROM_ReadBuffer(0x2BB0, (uint8_t *)&observer,24); + +void Read_LOCAL() { + EEPROM_ReadBuffer(0x2BB0, (uint8_t *) &observer, 24); // EEPROM_ReadBuffer(0x2BB0, (uint8_t *)&observer.lat,8); // EEPROM_ReadBuffer(0x2BB0+8,(uint8_t *)&observer.lon,8); // EEPROM_ReadBuffer(0x2BB0+16,(uint8_t *)&observer.height,8); - if(!(observer.lat>=-90&&observer.lat<=90)) observer.lat=85; - if(!(observer.lon>=-180&&observer.lon<=180))observer.lon=130; - if(!(observer.height>=-999999&& observer.height<=999999)) observer.height=20; - - - + if (!(observer.lat >= -90 && observer.lat <= 90)) observer.lat = 85; + if (!(observer.lon >= -180 && observer.lon <= 180))observer.lon = 130; + if (!(observer.height >= -999999 && observer.height <= 999999)) observer.height = 20; } + // 将浮点数转换为字符串 void floatToString(double num, char *str) { int isNegative = 0; // 标记是否为负数 @@ -936,8 +955,8 @@ void floatToString(double num, char *str) { num = -num; // 转换为正数处理 } - int integerPart = (int)num; // 获取整数部分 - double fractionalPart = num - integerPart; // 获取小数部分 + int integerPart = (int) num; // 获取整数部分 + double fractionalPart = num - integerPart; // 获取小数部分 // 计算整数部分的位数 int integerDigits = countIntegerDigits(integerPart); @@ -985,7 +1004,7 @@ void floatToString(double num, char *str) { // 处理小数部分 for (int j = 0; j < fractionalPrecision; j++) { fractionalPart *= 10; - int digit = (int)fractionalPart; + int digit = (int) fractionalPart; str[i++] = digit + '0'; fractionalPart -= digit; } @@ -993,12 +1012,12 @@ void floatToString(double num, char *str) { // 添加字符串结束符 str[i] = '\0'; } + char local_string[20]; -uint8_t local_string_index=0; -double lat_set,lon_set,alt_set; +uint8_t local_string_index = 0; +double lat_set, lon_set, alt_set; -void LOCAL_DISPLAY() -{ +void LOCAL_DISPLAY() { char str1[25]; UI_PrintStringSmallBuffer("Location", gStatusLine); @@ -1006,379 +1025,345 @@ void LOCAL_DISPLAY() UI_PrintStringSmall("Lat(deg):", 5, 0, 0); UI_PrintStringSmall("Lon(deg):", 5, 0, 2); UI_PrintStringSmall("Hight(m):", 5, 0, 4); -// if(!local_inflag){ - floatToString(observer.lat,str1); + // if(!local_inflag){ + floatToString(observer.lat, str1); UI_PrintStringSmall(str1, 0, 0, 1); - floatToString(observer.lon,str1); + floatToString(observer.lon, str1); UI_PrintStringSmall(str1, 0, 0, 3); - floatToString(observer.height,str1); + floatToString(observer.height, str1); UI_PrintStringSmall(str1, 0, 0, 5); - if(local_inflag) - { memset(gFrameBuffer[local_selected*2-1],0,128); - UI_PrintStringSmall(local_string, 0, 0, local_selected*2-1); + if (local_inflag) { + memset(gFrameBuffer[local_selected * 2 - 1], 0, 128); + UI_PrintStringSmall(local_string, 0, 0, local_selected * 2 - 1); UI_PrintStringSmall("INPUT", 10, 0, 6); - } - if(local_inflag) - memcpy(&gFrameBuffer[ local_selected*2-2][70], BITMAP_ARRAY_RIGHT, sizeof(BITMAP_ARRAY_RIGHT)); + if (local_inflag) + memcpy(&gFrameBuffer[local_selected * 2 - 2][70], BITMAP_ARRAY_RIGHT, sizeof(BITMAP_ARRAY_RIGHT)); else - memcpy(&gFrameBuffer[ local_selected*2-2][70], BITMAP_ARRAY_EMPTY_RIGHT, sizeof(BITMAP_ARRAY_RIGHT)); + memcpy(&gFrameBuffer[local_selected * 2 - 2][70], BITMAP_ARRAY_EMPTY_RIGHT, sizeof(BITMAP_ARRAY_RIGHT)); - sprintf(str1,"%02d/03",local_selected); + sprintf(str1, "%02d/03", local_selected); UI_PrintStringSmall(str1, 90, 0, 6); - } -void TLE_UI() -{ + +void TLE_UI() { memset(gFrameBuffer, 0, sizeof(gFrameBuffer)); memset(gStatusLine, 0, sizeof(gStatusLine)); -// if(mode==SELECT||mode==SATE -// #ifdef ENABLE_PIC -// || mode==PIC -// #endif -// ) + // if(mode==SELECT||mode==SATE + // #ifdef ENABLE_PIC + // || mode==PIC + // #endif + // ) DrawPower(); - switch (mode) - { + switch (mode) { #ifdef ENABLE_PIC - case PIC: - PIC_DISPLAY(); - break; + case PIC: + PIC_DISPLAY(); + break; #endif - case SELECT: - SELECT_DISPLAY(); - break; - case SATE: - SATE_DISPLAY(); - break; - case TIME: { - - char stringshowed[20]="20xx-xx-xx"; - char show2[20]="xx:xx:xx"; - uint8_t table[12]= {2,3,5,6,8,9,0,1,3,4,6,7}; - for (uint8_t i = 0; i < 6; i++) - { - if(freqInputString[i]!='-'&&freqInputString[i]!=0)stringshowed[table[i]]=freqInputString[i]; - if(freqInputString[i+6]!='-'&&freqInputString[i+6]!=0)show2[table[i+6]]=freqInputString[i+6]; - - } - - UI_PrintStringSmallBuffer("TimeSet", gStatusLine); + case SELECT: + SELECT_DISPLAY(); + break; + case SATE: + SATE_DISPLAY(); + break; + case TIME: { + char stringshowed[20] = "20xx-xx-xx"; + char show2[20] = "xx:xx:xx"; + uint8_t table[12] = {2, 3, 5, 6, 8, 9, 0, 1, 3, 4, 6, 7}; + for (uint8_t i = 0; i < 6; i++) { + if (freqInputString[i] != '-' && freqInputString[i] != 0)stringshowed[table[i]] = freqInputString[i]; + if (freqInputString[i + 6] != '-' && freqInputString[i + 6] != 0) + show2[table[i + 6]] = freqInputString[i + 6]; + } - UI_PrintStringSmall(stringshowed, 0, 127, 1); - UI_PrintStringSmall(show2, 0, 127, 3); - if(ENABLE_BTC) UI_PrintStringSmall("BTC", 5, 0, 6); - else UI_PrintStringSmall("UTC", 5, 0, 6); - break; - } - case LOCAL: - LOCAL_DISPLAY(); - break; + UI_PrintStringSmallBuffer("TimeSet", gStatusLine); + UI_PrintStringSmall(stringshowed, 0, 127, 1); + UI_PrintStringSmall(show2, 0, 127, 3); + if (ENABLE_BTC) UI_PrintStringSmall("BTC", 5, 0, 6); + else UI_PrintStringSmall("UTC", 5, 0, 6); + break; + } + case LOCAL: + LOCAL_DISPLAY(); + break; } ST7565_BlitFullScreen(); ST7565_BlitStatusLine(); } -void LocalCheckSave() -{ - char *endptr; - double num1=0; - uint8_t flag=0; - strd(local_string,&num1); - if(local_selected==1&&num1>=-90&&num1<=90) observer.lat=num1,flag=1; - else if(local_selected==2&&num1>=-180&&num1<=180) observer.lon=num1,flag=1; - else if(num1>=-999999&&num1<=999999) observer.height=num1,flag=1; - if(flag) Write_LOCAL(); - +void LocalCheckSave() { + char *endptr; + double num1 = 0; + uint8_t flag = 0; + strd(local_string, &num1); + if (local_selected == 1 && num1 >= -90 && num1 <= 90) observer.lat = num1, flag = 1; + else if (local_selected == 2 && num1 >= -180 && num1 <= 180) observer.lon = num1, flag = 1; + else if (num1 >= -999999 && num1 <= 999999) observer.height = num1, flag = 1; + if (flag) Write_LOCAL(); } -void INIT_LOCALINPUT() -{ - local_inflag=1; - local_dot_flag=0; - local_string_index=0; - memset(local_string,0,sizeof(local_string)); + +void INIT_LOCALINPUT() { + local_inflag = 1; + local_dot_flag = 0; + local_string_index = 0; + memset(local_string, 0, sizeof(local_string)); } -void SELECT_KEY() -{ - switch (my_kbd.current) - { - // case KEY_5: - // before_mode=mode; - // mode=TIME; - // freqInputIndex = 0; - // freqInputDotIndex = 0; - // ResetFreqInput(); - // break; - case KEY_UP: - now_menu-=1; - if(now_menu<1 ) now_menu=sate_info.num; - break; - case KEY_DOWN: - now_menu+=1; - if(now_menu>sate_info.num ) now_menu=1; - break; - case KEY_MENU: - switch_mode=1; - break; + +void SELECT_KEY() { + switch (my_kbd.current) { + // case KEY_5: + // before_mode=mode; + // mode=TIME; + // freqInputIndex = 0; + // freqInputDotIndex = 0; + // ResetFreqInput(); + // break; + case KEY_UP: + now_menu -= 1; + if (now_menu < 1) now_menu = sate_info.num; + break; + case KEY_DOWN: + now_menu += 1; + if (now_menu > sate_info.num) now_menu = 1; + break; + case KEY_MENU: + switch_mode = 1; + break; } } -void SATE_KEY() -{ - switch (my_kbd.current) - { - // case KEY_5: - // before_mode=mode; - // mode=TIME; - // freqInputIndex = 0; - // freqInputDotIndex = 0; - // ResetFreqInput(); - // break; - case KEY_0: - settings.listenBw+=1 ; - if(settings.listenBw==3)settings.listenBw=0; -// BK4819_FILTER_BW_WIDE - BK4819_SetFilterBandwidth(settings.listenBw, false); - - break; - - case KEY_1: + +void SATE_KEY() { + switch (my_kbd.current) { + // case KEY_5: + // before_mode=mode; + // mode=TIME; + // freqInputIndex = 0; + // freqInputDotIndex = 0; + // ResetFreqInput(); + // break; + case KEY_0: + settings.listenBw += 1; + if (settings.listenBw == 3)settings.listenBw = 0; + // BK4819_FILTER_BW_WIDE + BK4819_SetFilterBandwidth(settings.listenBw, false); + + break; + + case KEY_1: #ifdef ENABLE_PIC - if(mode==PIC) mode=SATE; - else + if (mode == PIC) mode = SATE; + else #endif - mode=PIC; - break; - case KEY_EXIT: -#ifdef ENABLE_PIC - if(mode==PIC) - { - mode=SATE; + mode = PIC; break; - } + case KEY_EXIT: +#ifdef ENABLE_PIC + if (mode == PIC) { + mode = SATE; + break; + } #endif - if(menuState)menuState=0; - else { - if(isTransmitting) - ToggleTX(false); - if(monitorMode||IsPeakOverLevel()) - ToggleRX(false); - isTransmitting=false; - monitorMode = false; - lockAGC = false; - //退出應用,進入選擇頁面 - mode=SELECT; - // DeInitSpectrum(); + if (menuState)menuState = 0; + else { + if (isTransmitting) + ToggleTX(false); + if (monitorMode || IsPeakOverLevel()) + ToggleRX(false); + isTransmitting = false; + monitorMode = false; + lockAGC = false; + //退出應用,進入選擇頁面 + mode = SELECT; + // DeInitSpectrum(); + } + break; + case KEY_STAR: + UpdateRssiTriggerLevel(true); + break; + case KEY_F: + UpdateRssiTriggerLevel(false); + break; + // case KEY_3: + // UpdateDBMax(true); + // break; + // case KEY_9: + // UpdateDBMax(false); + // break; - } - break; - case KEY_STAR: - UpdateRssiTriggerLevel(true); - break; - case KEY_F: - UpdateRssiTriggerLevel(false); - break; - // case KEY_3: - // UpdateDBMax(true); - // break; - // case KEY_9: - // UpdateDBMax(false); - // break; - - case KEY_UP: - if (menuState) - SetRegMenuValue(menuState, true); - - break; - case KEY_DOWN: - if (menuState) - SetRegMenuValue(menuState, false); - - break; - case KEY_PTT: - if(sat_get.TX_FREQ>1800000) - ToggleTX(true); - break; - - case KEY_MENU: - if (menuState == ARRAY_SIZE(registerSpecs) - 1) { - menuState = 1; - } else { - menuState++; - } - break; - case KEY_SIDE1: - if(!isTransmitting) - monitorMode = !monitorMode; - break; + case KEY_UP: + if (menuState) + SetRegMenuValue(menuState, true); + + break; + case KEY_DOWN: + if (menuState) + SetRegMenuValue(menuState, false); + + break; + case KEY_PTT: + if (sat_get.TX_FREQ > 1800000) + ToggleTX(true); + break; + + case KEY_MENU: + if (menuState == ARRAY_SIZE(registerSpecs) - 1) { + menuState = 1; + } else { + menuState++; + } + break; + case KEY_SIDE1: + if (!isTransmitting) + monitorMode = !monitorMode; + break; } } -void TIME_KEY() -{ - switch (my_kbd.current) - { - case KEY_0...KEY_9: - UpdateFreqInput(my_kbd.current); - if(freqInputIndex==12) { - char SHOW_TIME[6]; - SHOW_TIME[0]=10*(freqInputString[0]-'0')+(freqInputString[1]-'0'); - SHOW_TIME[1]=10*(freqInputString[2]-'0')+(freqInputString[3]-'0'); - SHOW_TIME[2]=10*(freqInputString[4]-'0')+(freqInputString[5]-'0'); - SHOW_TIME[3]=10*(freqInputString[6]-'0')+(freqInputString[7]-'0'); - SHOW_TIME[4]=10*(freqInputString[8]-'0')+(freqInputString[9]-'0'); - SHOW_TIME[5]=10*(freqInputString[10]-'0')+(freqInputString[11]-'0'); - if( ENABLE_BTC) - beijingToUtcTime(SHOW_TIME) ; - memcpy(my_time,SHOW_TIME,6); - EEPROM_WriteBuffer(0x02BA0,my_time,6); - - RTC_Set(); - - mode=before_mode; - } - break; - case KEY_EXIT: - if (freqInputIndex == 0) { - mode=before_mode; + +void TIME_KEY() { + switch (my_kbd.current) { + case KEY_0...KEY_9: + UpdateFreqInput(my_kbd.current); + if (freqInputIndex == 12) { + char SHOW_TIME[6]; + SHOW_TIME[0] = 10 * (freqInputString[0] - '0') + (freqInputString[1] - '0'); + SHOW_TIME[1] = 10 * (freqInputString[2] - '0') + (freqInputString[3] - '0'); + SHOW_TIME[2] = 10 * (freqInputString[4] - '0') + (freqInputString[5] - '0'); + SHOW_TIME[3] = 10 * (freqInputString[6] - '0') + (freqInputString[7] - '0'); + SHOW_TIME[4] = 10 * (freqInputString[8] - '0') + (freqInputString[9] - '0'); + SHOW_TIME[5] = 10 * (freqInputString[10] - '0') + (freqInputString[11] - '0'); + if (ENABLE_BTC) + beijingToUtcTime(SHOW_TIME); + memcpy(my_time, SHOW_TIME, 6); + EEPROM_WriteBuffer(0x02BA0, my_time, 6); +#ifdef ENABLE_RTC + DS3231_SetTime(my_time); +#else + RTC_Set(); +#endif + mode = before_mode; + } + break; + case KEY_EXIT: + if (freqInputIndex == 0) { + mode = before_mode; + break; + } + UpdateFreqInput(my_kbd.current); break; - } - UpdateFreqInput(my_kbd.current); - break; - // case KEY_MENU: - // if(freqInputIndex==10) { - // my_time[1]=10*(freqInputString[0]-'0')+(freqInputString[1]-'0'); - // my_time[2]=10*(freqInputString[2]-'0')+(freqInputString[3]-'0'); - // my_time[3]=10*(freqInputString[4]-'0')+(freqInputString[5]-'0'); - // my_time[4]=10*(freqInputString[6]-'0')+(freqInputString[7]-'0'); - // my_time[5]=10*(freqInputString[8]-'0')+(freqInputString[9]-'0'); - // RTC_Set(); - // } - // mode=before_mode; - // break; } } -void LOCAL_KEY() -{ - switch (my_kbd.current) - { - case KEY_UP: - case KEY_DOWN: - if(local_inflag==0) { - - local_selected+=my_kbd.current==KEY_UP?-1:1; - if(local_selected==4)local_selected=1; - if(local_selected==0)local_selected=3; - } - break; - case KEY_0...KEY_9: - case KEY_STAR: - case KEY_F: - if(!local_inflag) - { - INIT_LOCALINPUT(); - } - if(local_string_index<18)//没满 - { - if(local_string_index==0&&my_kbd.current!=KEY_STAR) { - if(my_kbd.current==KEY_F) local_string[local_string_index]='-'; - else local_string[local_string_index]='0'+my_kbd.current; - } else if(my_kbd.current==KEY_STAR&&local_dot_flag==0&&local_string_index!=0) { - local_string[local_string_index]='.'; - local_dot_flag=1; - } else if(my_kbd.current>=KEY_0&&my_kbd.current<=KEY_9) { - local_string[local_string_index]='0'+my_kbd.current; - - } else break; - local_string_index++; - } else { - //检查并保存 - LocalCheckSave(); - local_inflag=0; - } - break; - case KEY_MENU: - if(local_inflag) - { - //检查并保存 - LocalCheckSave(); - local_inflag=0; - } else { - - INIT_LOCALINPUT(); - - } - // mode=before_mode; - break; - case KEY_EXIT: - if(local_inflag&&local_string_index) - { - if(local_string_index) +void LOCAL_KEY() { + switch (my_kbd.current) { + case KEY_UP: + case KEY_DOWN: + if (local_inflag == 0) { + local_selected += my_kbd.current == KEY_UP ? -1 : 1; + if (local_selected == 4)local_selected = 1; + if (local_selected == 0)local_selected = 3; + } + break; + case KEY_0...KEY_9: + case KEY_STAR: + case KEY_F: + if (!local_inflag) { + INIT_LOCALINPUT(); + } + if (local_string_index < 18) //没满 { - local_string_index--; - local_string[local_string_index]=0; + if (local_string_index == 0 && my_kbd.current != KEY_STAR) { + if (my_kbd.current == KEY_F) local_string[local_string_index] = '-'; + else local_string[local_string_index] = '0' + my_kbd.current; + } else if (my_kbd.current == KEY_STAR && local_dot_flag == 0 && local_string_index != 0) { + local_string[local_string_index] = '.'; + local_dot_flag = 1; + } else if (my_kbd.current >= KEY_0 && my_kbd.current <= KEY_9) { + local_string[local_string_index] = '0' + my_kbd.current; + } else break; + local_string_index++; } else { - local_inflag=0; + //检查并保存 + LocalCheckSave(); + local_inflag = 0; } - } else if(local_inflag) { - local_inflag=0; - } else { - mode=before_mode; - } - break; + break; + case KEY_MENU: + if (local_inflag) { + //检查并保存 + LocalCheckSave(); + local_inflag = 0; + } else { + INIT_LOCALINPUT(); + } + break; + case KEY_EXIT: + if (local_inflag && local_string_index) { + if (local_string_index) { + local_string_index--; + local_string[local_string_index] = 0; + } else { + local_inflag = 0; + } + } else if (local_inflag) { + local_inflag = 0; + } else { + mode = before_mode; + } + break; } } -void TLE_KEY() -{ - if(my_kbd.current==KEY_SIDE2) { - if(BACK_ON) - PWM_PLUS0_CH0_COMP = 0<<2; - else PWM_PLUS0_CH0_COMP = 255<<2; - BACK_ON=1-BACK_ON; + +void TLE_KEY() { + if (my_kbd.current == KEY_SIDE2) { + if (BACK_ON) + PWM_PLUS0_CH0_COMP = 0 << 2; + else + PWM_PLUS0_CH0_COMP = 255 << 2; + BACK_ON = 1 - BACK_ON; } - if(mode==SATE||mode==SELECT + if (mode == SATE || mode == SELECT #ifdef ENABLE_PIC - || mode==PIC + || mode == PIC #endif - ) { - switch (my_kbd.current) - { - case KEY_5: - before_mode=mode; - mode=TIME; - freqInputIndex = 0; - freqInputDotIndex = 0; - ResetFreqInput(); - return; - case KEY_4: - before_mode=mode; - mode=LOCAL; - INIT_LOCALINPUT(); - local_inflag=0; - return; - case KEY_8: - ENABLE_BTC=1-ENABLE_BTC; - return; + ) { + switch (my_kbd.current) { + case KEY_5: + before_mode = mode; + mode = TIME; + freqInputIndex = 0; + freqInputDotIndex = 0; + ResetFreqInput(); + return; + case KEY_4: + before_mode = mode; + mode = LOCAL; + INIT_LOCALINPUT(); + local_inflag = 0; + return; + case KEY_8: + ENABLE_BTC = 1 - ENABLE_BTC; + return; } - } switch (mode) { - case SELECT: - SELECT_KEY(); - break; + case SELECT: + SELECT_KEY(); + break; #ifdef ENABLE_PIC - case PIC: + case PIC: #endif - case SATE: - SATE_KEY(); - break; - case TIME: - TIME_KEY(); - break; - case LOCAL: - LOCAL_KEY(); - break; + case SATE: + SATE_KEY(); + break; + case TIME: + TIME_KEY(); + break; + case LOCAL: + LOCAL_KEY(); + break; } } @@ -1401,31 +1386,27 @@ void ERROR_DISPLAY() { } -void TLE_PROCESS() -{ - if(mode==SELECT) - { - if(switch_mode==1) - { - switch_mode=0; - Read_TLE(sate_info.list[ now_menu-1],&sat_get); +void TLE_PROCESS() { + if (mode == SELECT) { + if (switch_mode == 1) { + switch_mode = 0; + Read_TLE(sate_info.list[now_menu - 1], &sat_get); - mode=SATE; - DOPPLER_FLASH=1; + mode = SATE; + DOPPLER_FLASH = 1; } - } - if(mode==SATE + if (mode == SATE #ifdef ENABLE_PIC - || mode==PIC + || mode == PIC #endif - ) { - if ( my_kbd.current == KEY_INVALID&&isTransmitting) { + ) { + if (my_kbd.current == KEY_INVALID && isTransmitting) { ToggleTX(false); } - if (isListening ) { + if (isListening) { UpdateListening(); } else { UpdateStill(); @@ -1433,15 +1414,16 @@ void TLE_PROCESS() // RTC_Get(); // if() - if(DOPPLER_FLASH) - { - DOPPLER_FLASH=0; - cal_sat(sat_get.name,sat_get.line1,sat_get.line2,observer,&look,&sub_point,my_time); - if(sat_get.TX_FREQ>1800000) - sat_get.UP_LINK= doppler_shift(sat_get.TX_FREQ, sub_point.sate_eci, sub_point.r_dot, look.observer_eci,10); - - sat_get.DOWN_LINK= doppler_shift(sat_get.RX_FREQ, sub_point.sate_eci, sub_point.r_dot, look.observer_eci,0); - if (!isTransmitting&¤tFreq!=sat_get.RX_FREQ) { + if (DOPPLER_FLASH) { + DOPPLER_FLASH = 0; + cal_sat(sat_get.name, sat_get.line1, sat_get.line2, observer, &look, &sub_point, my_time); + if (sat_get.TX_FREQ > 1800000) + sat_get.UP_LINK = doppler_shift(sat_get.TX_FREQ, sub_point.sate_eci, sub_point.r_dot, look.observer_eci, + 10); + + sat_get.DOWN_LINK = doppler_shift(sat_get.RX_FREQ, sub_point.sate_eci, sub_point.r_dot, look.observer_eci, + 0); + if (!isTransmitting && currentFreq != sat_get.RX_FREQ) { SetF(sat_get.DOWN_LINK); currentFreq = sat_get.DOWN_LINK; } @@ -1449,10 +1431,22 @@ void TLE_PROCESS() } } -void TLE_Main() -{ +// 比较两个时间,返回值: +// -1 表示 time2 更新,1 表示 time1 更新,0 表示相同 +int compare_times(uint8_t time1[6], uint8_t time2[6]) { + // 循环比较每个字段(年、月、日、时、分、秒)3 11 11 3 15 2 + for (int i = 0; i < 6; i++) { + if (time1[i] < time2[i]) return 0; // time1 比 time2 更新 + if (time1[i] > time2[i]) return 1; // time2 比 time1 更新 + } + // 如果循环完没有返回,说明时间相同 + return 0; +} + +// int cntt=0; +void TLE_Main() { Read_LOCAL(); -// while(1); + // while(1); isListening = true; // to turn off RX later // ToggleRX(true), ToggleRX(false); // hack to prevent noise when squelch off @@ -1463,42 +1457,261 @@ void TLE_Main() // settings.listenBw = 0; // settings.modulationType = MODULATION_FM; // TuneToPeak(); - sat_get.DOWN_LINK= sat_get.RX_FREQ ; - sat_get.UP_LINK= sat_get.TX_FREQ ; + sat_get.DOWN_LINK = sat_get.RX_FREQ; + sat_get.UP_LINK = sat_get.TX_FREQ; - currentFreq= sat_get.DOWN_LINK; - EEPROM_ReadBuffer(0x02BA0,my_time,6); + currentFreq = sat_get.DOWN_LINK; // settings.dbMin = -130; // uint8_t INIT_TIME[6]= {25,1,27,8,28,42}; // memcpy(my_time,INIT_TIME,6); + EEPROM_ReadBuffer(0x02BA0, my_time, 6); + +#ifdef ENABLE_RTC + if (my_time[0] >= 25 && my_time[0] <= 99 && my_time[1] <= 12 && my_time[2] <= 31\ + && my_time[3] <= 24 && my_time[4] <= 60 && my_time[5] <= 60) { + uint8_t store_time[6]; + DS3231_GetTime(store_time); + if (compare_times(my_time, store_time)) + DS3231_SetTime(my_time); + else + memcpy(my_time, store_time, 6); + } else { + DS3231_GetTime(my_time); + if (my_time[0] < 25) { + before_mode = SELECT; + mode = TIME; + } + } +#else RTC_Set(); - - if(tle_check()==0) - { - - - if(sate_info.num>45 || sate_info.num==0) { +#endif + if (tle_check() == 0) { + if (sate_info.num > 45 || sate_info.num == 0) { ERROR_DISPLAY(); NVIC_SystemReset(); } } - while(1) - { + while (1) { +#ifdef ENABLE_RTC + DS3231Handler(); +#endif TLE_PROCESS(); TLE_UI(); UART_READ(); SYSTEM_DelayMs(10); - } } - +#ifndef ENABLE_RTC void RTCHandler(void) { - RTC_Get(); DOPPLER_FLASH=1; + RTC_IF |= (1 << 5);//清除中断标志位 +} +#else +void DS3231Handler(void) { + uint8_t get_time[6]; + DS3231_GetTime(get_time); + for (uint8_t i = 0; i < 6; i++) { + if (get_time[i] != my_time[i]) { + DOPPLER_FLASH = 1; + for (uint8_t j = 0; j < 6; j++) my_time[j] = get_time[j]; + return; + } + } +} +#endif - RTC_IF |= (1 << 5);//清除中断标志位 -} \ No newline at end of file +uint8_t back_point[109][2] = { + {26, 0}, + {27, 0}, + {28, 0}, + {29, 0}, + {30, 0}, + {31, 0}, + {32, 0}, + {33, 0}, + {34, 1}, + {35, 1}, + {36, 1}, + {37, 1}, + {38, 1}, + {39, 1}, + {40, 2}, + {41, 2}, + {42, 2}, + {43, 3}, + {44, 3}, + {45, 3}, + {46, 4}, + {47, 4}, + {48, 5}, + {49, 5}, + {50, 6}, + {51, 6}, + {52, 7}, + {53, 7}, + {54, 8}, + {55, 9}, + {56, 9}, + {57, 10}, + {57, 11}, + {58, 11}, + {58, 12}, + {59, 12}, + {59, 13}, + {60, 13}, + {60, 14}, + {60, 15}, + {61, 15}, + {61, 16}, + {62, 16}, + {62, 17}, + {62, 18}, + {63, 18}, + {63, 19}, + {63, 20}, + {64, 20}, + {64, 21}, + {64, 22}, + {64, 23}, + {64, 24}, + {64, 25}, + {64, 26}, + {26, 9}, + {27, 9}, + {28, 9}, + {29, 9}, + {30, 9}, + {31, 9}, + {32, 9}, + {33, 9}, + {34, 10}, + {35, 10}, + {36, 10}, + {37, 10}, + {38, 11}, + {39, 11}, + {40, 11}, + {41, 12}, + {42, 12}, + {43, 13}, + {44, 13}, + {45, 14}, + {46, 15}, + {47, 16}, + {47, 17}, + {48, 17}, + {48, 18}, + {49, 18}, + {49, 19}, + {50, 19}, + {50, 20}, + {50, 21}, + {51, 21}, + {51, 22}, + {51, 23}, + {51, 24}, + {51, 25}, + {51, 26}, + {26, 17}, + {27, 17}, + {28, 17}, + {29, 18}, + {30, 18}, + {31, 18}, + {32, 18}, + {33, 19}, + {34, 19}, + {35, 20}, + {36, 20}, + {37, 21}, + {37, 22}, + {37, 23}, + {38, 23}, + {38, 24}, + {38, 25}, + {38, 26}, +}; +uint8_t num_point[28][2] = { + {0, 5}, + {0, 6}, + {0, 4}, + {1, 6}, + {1, 4}, + {1, 7}, + {1, 3}, + {2, 8}, + {2, 2}, + {3, 8}, + {3, 2}, + {4, 8}, + {4, 2}, + {5, 8}, + {5, 2}, + {6, 8}, + {6, 2}, + {7, 8}, + {7, 2}, + {8, 8}, + {8, 2}, + {9, 7}, + {9, 3}, + {9, 6}, + {9, 4}, + {10, 6}, + {10, 4}, + {10, 5}, +}; +uint8_t fill_point[39][2] = { + {0, 4}, + {0, 5}, + {1, 4}, + {1, 5}, + {1, 3}, + {1, 6}, + {2, 2}, + {2, 3}, + {2, 4}, + {2, 5}, + {2, 6}, + // {2, 7}, + {3, 2}, + {3, 3}, + {3, 4}, + {3, 5}, + {3, 6}, + // {3, 7}, + {4, 2}, + {4, 3}, + {4, 4}, + {4, 5}, + {4, 6}, + // {4, 7}, + {5, 2}, + {5, 3}, + {5, 4}, + {5, 5}, + {5, 6}, + // {5, 7}, + {6, 2}, + {6, 3}, + {6, 4}, + {6, 5}, + {6, 6}, + // {6, 7}, + {7, 2}, + {7, 3}, + {7, 4}, + {7, 5}, + {7, 6}, + // {7, 7}, + {8, 3}, + {8, 4}, + {8, 5}, + // {8, 6}, + // {9, 4}, + // {9, 5} +};