diff --git a/Keil_5/ble_app_peripheral.uvoptx b/Keil_5/ble_app_peripheral.uvoptx index abb79ea..b081216 100644 --- a/Keil_5/ble_app_peripheral.uvoptx +++ b/Keil_5/ble_app_peripheral.uvoptx @@ -140,7 +140,7 @@ 0 JL2CM3 - -U480066255 -O78 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BB11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO7 -FD20000000 -FC1000 -FN1 -FF0NEW_DEVICE.FLM -FS00 -FL040000 -FP0($$Device:ARMCM0$Device\ARM\Flash\NEW_DEVICE.FLM) + -U20090928 -O78 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BB11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO7 -FD20000000 -FC1000 -FN1 -FF0NEW_DEVICE.FLM -FS00 -FL040000 -FP0($$Device:ARMCM0$Device\ARM\Flash\NEW_DEVICE.FLM) 0 diff --git a/src/epd/epd_gui.c b/src/epd/epd_gui.c index 00a2937..f8fff37 100644 --- a/src/epd/epd_gui.c +++ b/src/epd/epd_gui.c @@ -121,7 +121,7 @@ void draw_qr_code( int byte_idx = x / 8; // 每4字节一行,8bit一个字节 int bit_idx = 7 - (x % 8); // 图像从高位到低位存储 int bit = (img[y][byte_idx] >> bit_idx) & 1; - int color = (bit == 1) ? WHITE : BLACK; + int color = (bit == 0) ? WHITE : BLACK; // 放大绘制 int x1 = start_x + x * pix_size; diff --git a/src/user_custs1_impl.c b/src/user_custs1_impl.c index 9c4968a..4594c7b 100644 --- a/src/user_custs1_impl.c +++ b/src/user_custs1_impl.c @@ -69,6 +69,7 @@ static uint8_t h24_format = 1; // 24小时制标志 static void get_holiday(void); +extern int adv_state; /* * FUNCTION DEFINITIONS **************************************************************************************** @@ -805,10 +806,15 @@ void QR_draw() memset(fb_bw, 0xff, scr_h*line_bytes); memset(fb_rr, 0x00, scr_h*line_bytes); - draw_qr_code(20, 5, 3, QR_31x31); + draw_qr_code(5, 5, 3, QR_31x31); + draw_text(100, 5,"Bluetooth", BLACK); + draw_text(100, 20, "DLG-CLOCK ", BLACK); + draw_text(170,20,bt_id,BLACK); + + draw_text(110,40,"-------------",BLACK); - draw_text(120, 5, "USE WEB", BLACK); - draw_text(120, 20, "Scan QR", BLACK); + draw_text(100, 60, "Scan the QR code", BLACK); + draw_text(100, 75, "with your browser", BLACK); // 墨水屏更新显示 epd_init(); epd_screen_update(); @@ -828,7 +834,7 @@ void LB_draw() memset(fb_bw, 0xff, scr_h*line_bytes); memset(fb_rr, 0x00, scr_h*line_bytes); - draw_qr_code(20, 10, 4, LB_31x31); + draw_qr_code(60, 10, 4, LB_31x31); // 墨水屏更新显示 epd_init(); diff --git a/src/user_peripheral.c b/src/user_peripheral.c index 250c43e..1d61e21 100644 --- a/src/user_peripheral.c +++ b/src/user_peripheral.c @@ -51,7 +51,7 @@ int app_connection_idx __SECTION_ZERO("retention_mem_ar timer_hnd app_clock_timer_used __SECTION_ZERO("retention_mem_area0"); // 时钟定时器句柄,retention内存保存 timer_hnd app_param_update_request_timer_used __SECTION_ZERO("retention_mem_area0"); // 参数更新请求定时器句柄,retention内存保存 -static int adv_state; // 广播状态:0-未广播,1-正在广播 +int adv_state = 0; // 广播状态:0-未广播,1-正在广播 static int otp_btaddr[2]; // 从OTP读取的蓝牙地址 static int otp_boot; // 从OTP读取的启动相关数据 static char adv_name[20]; // 广播名称缓冲区 @@ -268,8 +268,12 @@ static void app_clock_timer_cb(void) // 如果是快速更新,更新ADC数据,若电量不足则不继续执行任务 if(flags==4){ adc1_update(); + //ADC电压小于2.6V if(adcval<1360){ + //绘制低电量图标 LB_draw(); + //清除定时器唤醒任务 + app_easy_timer_cancel(app_clock_timer_used); return; } } @@ -324,7 +328,8 @@ void user_app_on_db_init_complete( void ) clock_push(); // 绘制时钟(带蓝牙图标+全量更新)并启动广播 - clock_draw(DRAW_BT|UPDATE_FULL); + //clock_draw(DRAW_BT|UPDATE_FULL); + QR_draw(); user_app_adv_start(); // 启动时钟定时器 @@ -419,6 +424,12 @@ void user_app_adv_undirect_complete(uint8_t status) // 状态非0表示异常结束,更新广播状态并刷新屏幕 if(status!=0){ adv_state = 0; + //未进行初始化,则始终展示二维码 + if(year==2025 && month<=5){ + // 在2024年2月执行特定操作(占位符) + QR_draw(); + } + else clock_draw(UPDATE_FLY); } } @@ -449,6 +460,12 @@ void user_app_disconnect(struct gapc_disconnect_ind const *param) if(param->reason!=CO_ERROR_REMOTE_USER_TERM_CON){ user_app_adv_start(); }else{ + //未进行初始化,则始终展示二维码 + if(year==2025 && month<=5){ + // 在2024年2月执行特定操作(占位符) + QR_draw(); + } + else clock_draw(UPDATE_FLY); }