From 03f652f7afb24678d565d1b12f12b0fa27444dd2 Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Mon, 27 Feb 2017 17:20:47 +0100 Subject: [PATCH] remove tcp busy loop --- Devices/mTaskTCP.icl | 8 ++++---- client/main.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Devices/mTaskTCP.icl b/Devices/mTaskTCP.icl index e0b85e2..dfa7f2f 100644 --- a/Devices/mTaskTCP.icl +++ b/Devices/mTaskTCP.icl @@ -24,9 +24,9 @@ instance MTaskDuplex TCPSettings where onConnect _ (msgs,send,sendStopped) = (Ok "", Just (msgs,[],sendStopped), map encode send, False) whileConnected :: (Maybe String) String ([MTaskMSGRecv], [MTaskMSGSend],Bool) -> (MaybeErrorString String, Maybe ([MTaskMSGRecv],[MTaskMSGSend],Bool), [String], Bool) - whileConnected mnewData acc (msgs,send,sendStopped) - | not (trace_tn (printToString (map decode (maybeToList mnewData)))) = undef - = (Ok acc, Just (msgs ++ map decode (maybeToList mnewData),[],sendStopped), map encode send, False) + whileConnected Nothing _ (_,[],_) = (Ok "", Nothing, [], False) + whileConnected md _ (msgs,send,sendStopped) + = (Ok "", Just (msgs++map decode (maybeToList md),[],sendStopped), map encode send, False) onDisconnect :: String ([MTaskMSGRecv],[MTaskMSGSend],Bool) -> (MaybeErrorString String, Maybe ([MTaskMSGRecv],[MTaskMSGSend],Bool)) - onDisconnect l (msgs,send,sendStopped) = (Ok l, Nothing) + onDisconnect _ (msgs,send,sendStopped) = (Ok "", Nothing) diff --git a/client/main.c b/client/main.c index 337834f..9fc91df 100644 --- a/client/main.c +++ b/client/main.c @@ -84,11 +84,11 @@ void loop(void) curtask->lastrun = cyclestart; if(curtask->interval == 0){ curtask->used = false; - write_byte('m'); - write_byte('d'); - write_byte('\n'); +// write_byte('m'); +// write_byte('d'); +// write_byte('\n'); } - write_byte('\n'); +// write_byte('\n'); } } -- 2.20.1