lpcmanager

45715d2aaaf4
Fix SmartehCloud updates applying multiple times when re-connecting.
Ensure that LPCMQTT command execution is serialized.
This is a consequence of duplicate messages sent at init.
Seems to happen either because server or client ignores "cleansession"/"cleanstart".
if(!pthread_mutex_lock(&UART_WriteMutex)){
int prevstate;
prevstate=uartDevWriteBuf_plc_state;
uartDevWriteBuf_plc_state = LOCKED;
pthread_mutex_unlock(&UART_WriteMutex);
%(publish_code)s
/* unlock plc buffer */
uartDevWriteBuf_plc_state = FULL;
/* wakeup task */
pthread_mutex_lock(&UART_WakeCondLock);
UART_WakeCondValue = 1;
pthread_cond_signal(&UART_WakeCond);
pthread_mutex_unlock(&UART_WakeCondLock);
}