浏览代码

优化代码

whc 6 月之前
父节点
当前提交
c1dee35dde
共有 4 个文件被更改,包括 9 次插入99 次删除
  1. 6 2
      .vscode/settings.json
  2. 3 3
      components/FONT_LIB/FONT_LIB.c
  3. 0 19
      main/user_config.h
  4. 0 75
      main/yc_protocol.c

+ 6 - 2
.vscode/settings.json

@@ -37,6 +37,10 @@
         "unordered_map": "c",
         "iot_button.h": "c",
         "gpio.h": "c",
-        "esp_system.h": "c"
-    }
+        "esp_system.h": "c",
+        "sstream": "c",
+        "initializer_list": "c",
+        "regex": "c"
+    },
+    "idf.adapterTargetName": "esp32s3"
 }

+ 3 - 3
components/FONT_LIB/FONT_LIB.c

@@ -61,7 +61,7 @@ void font_spi_write(unsigned char value)
 {
 	int i = 0, data = value;
 
-	gpio_set_level(FONT_CLK_PIN, LOW_LEVEL);
+	FONT_CLK_0;
 
 	for (i = 0; i < 8; i++)
 	{
@@ -75,9 +75,9 @@ void font_spi_write(unsigned char value)
 			FONT_SDA_0;
 		}
 		// ets_delay_us(1);
-		gpio_set_level(FONT_CLK_PIN, HIGH_LEVEL);
+		FONT_CLK_1;
 		// ets_delay_us(1);
-		gpio_set_level(FONT_CLK_PIN, LOW_LEVEL);
+		FONT_CLK_0;
 		data = ((data << 1) & 0xff);
 	}
 }

+ 0 - 19
main/user_config.h

@@ -36,25 +36,6 @@ typedef enum
 #define SCREEN_WIDTH 648
 #define SCREEN_HEIGHT 480
 
-#define IS_FEB_MONTH ((Machine_info.day == 29) && (Machine_info.month == 2) && \
-                      (!((Machine_info.year / 4 == 0) || (Machine_info.year / 2000 == 0))))
-
-#define IS_LEAP_YEAR ((Machine_info.day == 30) && (Machine_info.month == 2) && \
-                      ((Machine_info.year / 4 == 0) || (Machine_info.year / 2000 == 0)))
-
-#define IS_SMALL_MONTH ((Machine_info.day == 31) && ((Machine_info.month == 4) || \
-                                                     (Machine_info.month == 6) || \
-                                                     (Machine_info.month == 9) || \
-                                                     (Machine_info.month == 11)))
-
-#define IS_BIG_MONTH ((Machine_info.day == 32) && ((Machine_info.month == 1) ||  \
-                                                   (Machine_info.month == 3) ||  \
-                                                   (Machine_info.month == 5) ||  \
-                                                   (Machine_info.month == 7) ||  \
-                                                   (Machine_info.month == 8) ||  \
-                                                   (Machine_info.month == 10) || \
-                                                   (Machine_info.month == 12)))
-
 extern FONT_TYPE_T ascii_type_5x7;
 extern FONT_TYPE_T ascii_type_7x8;
 extern FONT_TYPE_T ascii_type_6x12;

+ 0 - 75
main/yc_protocol.c

@@ -3011,82 +3011,7 @@ void set_status_heights(void)
     //                 arr_heights[0],arr_heights[1],arr_heights[2],
     //                 arr_heights[3],arr_heights[4],arr_heights[5]);
 }
-// void periodic_timer_callback(void* arg)
-// {
-//     // if(++Machine_info.sec == 60)
-//     // {
-//     //     last_button_info.time_min+=1;
-//     //     set_status_heights();
-//     //     printf("time min ++\r\n");
-//     //     printf("YEAR = %d,MONTH =%d,DAY=%d,HOUR=%d,MIN=%d,SEC =%d\r\n",
-//     //     Machine_info.year,
-//     //     Machine_info.month,
-//     //     Machine_info.day,
-//     //     Machine_info.hour,
-//     //     Machine_info.min,
-//     //     Machine_info.sec);
-
-//     //     Machine_info.sec=0;
-//     //     if(++Machine_info.min == 60)
-//     //     {
-//     //         Machine_info.min=0;
-//     //         if(++Machine_info.hour == 24)
-//     //         {
-//     //             Machine_info.hour=0;
-//     //             Machine_info.day++;
-
-//     //             if(IS_FEB_MONTH && IS_LEAP_YEAR && IS_SMALL_MONTH && IS_BIG_MONTH)
-//     //             {
-//     //                 Machine_info.day=0;
-
-//     //                 if(++Machine_info.month == 13)
-//     //                 {
-//     //                     Machine_info.month=1;
-//     //                     Machine_info.year++;
-//     //                 }
-//     //             }
-//     //         }
-//     //     }
-//     // }
-// }
-
-// void lora_timer_callback(void *arg)
-// {
-//     ESP_LOGI(LOG_TAG, " lora_timer_callback");
 
-//     if (xQueueSend(yc_data_queue, &yc_data, 0) != true)
-//     {
-//         ESP_LOGE(LOG_TAG, "yc_data_queue send is fail");
-//     }
-//     yc_data.len = 0;
-//     yc_data.index = 0;
-// }
-// void timer_init(void)
-// {
-//     // const esp_timer_create_args_t periodic_timer_args = {
-//     //         .callback = &periodic_timer_callback,
-//     //         /* name is optional, but may help identify the timer when debugging */
-//     //         .name = "periodic"
-//     // };
-
-//     // ESP_ERROR_CHECK(esp_timer_create(&periodic_timer_args, &periodic_timer));
-//     // /* The timer has been created but is not running yet */
-
-//     // ESP_ERROR_CHECK(esp_timer_start_periodic(periodic_timer, 1*1000*1000));
-
-//     // lora timer
-//     const esp_timer_create_args_t lora_timer_args = {
-//         .callback = &lora_timer_callback,
-//         /* argument specified here will be passed to timer callback function */
-//         .name = "one-shot"};
-//     ESP_ERROR_CHECK(esp_timer_create(&lora_timer_args, &lora_timer));
-// }
-// void yc_timer_restart(void)
-// {
-//     ESP_LOGI(LOG_TAG,"timer restart");
-//     ESP_ERROR_CHECK(esp_timer_stop(periodic_timer));
-//     ESP_ERROR_CHECK(esp_timer_start_periodic(periodic_timer, 1*1000*1000));
-// }
 
 void lora_timer_start(void)
 {