Przeglądaj źródła

[BT-6710]portgw fix - remove rs485_mutex

balbekova 5 lat temu
rodzic
commit
8106c83072

+ 3 - 0
modules/ds18b20/onewire.c

@@ -27,6 +27,7 @@
 #undef DBG
 #define DBG if(0)
 
+#ifdef DALLAS_SENSOR_ENABLE
 /**
   * @brief  Размер буфера для отправки данных датчикам
   */
@@ -367,3 +368,5 @@ uint8_t DALLAS_ToByte(uint8_t *ow_bits)
     }
     return ow_byte;
 }
+
+#endif

+ 2 - 4
modules/portgw/portgw.c

@@ -87,7 +87,7 @@ void serial_reinit()
             wordlen = 8;
             break;
     }
-    uart_hw_init(RS485_USART, sSettings.sPortGw.baud, wordlen, parity, stop);
+    uart_config_reinit(RS485_USART, sSettings.sPortGw.baud, wordlen, parity, stop);
 }
 
 /* Stop server */
@@ -576,7 +576,7 @@ void portgw_thread(void *arg)
                 stop_server();
             }
 
-            if (enabled && xSemaphoreTake(rs485mutex, portMAX_DELAY) == pdTRUE) {
+            if (enabled) {
                 /* (Re)start server */
                 if (!start_server(transtype, port)) {
                     DBG printf("Server start error\n");
@@ -592,7 +592,6 @@ void portgw_thread(void *arg)
                 if (uxQueueMessagesWaiting(rs485RxQ) > 0) {
                     xQueueReset(rs485RxQ);
                 }
-                xSemaphoreGive(rs485mutex);
                 vTaskDelay(5000);
                 continue;
             }
@@ -615,7 +614,6 @@ void portgw_thread(void *arg)
         }
 
         if (!enabled) {
-            xSemaphoreGive(rs485mutex);
             vTaskDelay(5000);
             continue;
         }

+ 0 - 2
peripheral_modules/inc/usart.h

@@ -47,8 +47,6 @@
 
 /* Queue */
 QueueHandle_t rs485TxQ, rs485RxQ;
-/* RS485 mutex */
-SemaphoreHandle_t rs485mutex;
 
 void rs485_enable_tx(void);
 #endif

+ 0 - 1
peripheral_modules/src/usart.c

@@ -164,7 +164,6 @@ void InitUSART(void)
 #ifdef RS485_USART
     rs485TxQ = xQueueCreate(RS485_RBUF_SIZE, 1);
     rs485RxQ = xQueueCreate(RS485_RBUF_SIZE, 1);
-    rs485mutex = xSemaphoreCreateMutex();
     /* Initial configuration. Port will be reconfigured later according to settings */
     uart_hw_init(RS485_USART, RS485_USART_BAUD, RS485_USART_WORD_LEN, RS485_USART_PARITY, RS485_USART_STOP_BIT);
 #endif