Quellcode durchsuchen

fix:没有开启串口回调功能就无法读取数据了,因为没开启RX中断
add:x2 y2 超出范围也可以显示了

alienwalker vor 3 Jahren
Ursprung
Commit
60707c926e

+ 3 - 0
application/src/luat_base_air105.c

@@ -214,6 +214,9 @@ static const luaL_Reg loadedlibs[] = {
 #endif
 #ifdef LUAT_USE_FONTS
   {"fonts", luaopen_fonts},
+#endif
+#ifdef LUAT_USE_MLX90640
+  {"mlx90640", luaopen_mlx90640},
 #endif
   {"usbapp", luaopen_usbapp},
   {"audio", luaopen_multimedia_audio},

+ 11 - 8
application/src/luat_spi_air105.c

@@ -355,25 +355,28 @@ int luat_lcd_draw(luat_lcd_conf_t* conf, uint16_t x1, uint16_t y1, uint16_t x2,
         return 0;
     }
     // buff模式
-    if (x1 > conf->w || x2 > conf->w || y1 > conf->h || y2 > conf->h) {
-        //LLOGW("out of lcd range");
+    if (x1 > conf->w || y1 > conf->h) {
+        LLOGE("out of lcd range");
         return -1;
     }
+    uint16_t x_end = x2 > conf->w?conf->w:x2;
+    uint16_t y_end = y2 > conf->h?conf->h:y2;
     luat_color_t* dst = (conf->buff + x1 + conf->w * y1);
     luat_color_t* src = (color);
-    size_t lsize = (x2 - x1 + 1);
-    for (size_t i = 0; i < (y2 - y1 + 1); i++) {
+    size_t lsize = (x_end - x1 + 1);
+    for (size_t i = y1; i <= y_end; i++) {
         memcpy(dst, src, lsize * sizeof(luat_color_t));
         dst += conf->w;  // 移动到下一行
         src += lsize;    // 移动数据
+        if (x2 > conf->w){
+            src+=x2 - conf->w;
+        }
     }
-
     // 存储需要刷新的区域
     if (y1 < conf->flush_y_min)
         conf->flush_y_min = y1;
-    if (y2 > conf->flush_y_max)
-        conf->flush_y_max = y2;
-
+    if (y_end > conf->flush_y_max)
+        conf->flush_y_max = y_end;
     return 0;
 }
 #endif

+ 7 - 4
application/src/luat_uart_air105.c

@@ -240,6 +240,9 @@ int luat_uart_setup(luat_uart_t *uart){
         	serials[uart->id].rs485_timer = Timer_Create(luat_uart_wait_timer_cb, uart->id, NULL);
         }
         GPIO_Config(serials[uart->id].rs485_pin, 0, serials[uart->id].rs485_param_bit.rx_level);
+#ifndef UART_RX_USE_DMA
+        Uart_EnableRxIrq(uart->id);
+#endif
     }
 
     return 0;
@@ -272,7 +275,7 @@ int luat_uart_read(int uartid, void *buffer, size_t length){
         ret = Core_VUartRxBufferRead(VIRTUAL_UART0, (uint8_t *)buffer,length);
     else
         ret = Uart_RxBufferRead(uartid, (uint8_t *)buffer,length);
-    // LLOGD("uartid:%d buffer:%s ",uartid,buffer);
+//    LLOGD("uartid:%d buffer:%s ret:%d ",uartid,buffer, ret);
     return ret;
 }
 
@@ -298,9 +301,9 @@ int luat_setup_cb(int uartid, int received, int sent){
         Core_VUartSetCb(VIRTUAL_UART0, luat_uart_usb_cb);
     else {
         Uart_SetCb(uartid, luat_uart_cb);
-#ifndef UART_RX_USE_DMA
-        Uart_EnableRxIrq(uartid);
-#endif
+//#ifndef UART_RX_USE_DMA
+//        Uart_EnableRxIrq(uartid);
+//#endif
     }
     return 0;
 }