ctucx.git: smartied

[nimlang] smarthome server

commit 4bf8045fab79743f3d3313204762db84f2600492
parent 5c3899701fb9fdd80e0b166304f483c59f3b48f5
Author: Milan Pässler <me@pbb.lc>
Date: Sun, 14 Jul 2019 15:10:28 +0200

comment out some things
4 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/src/backend_powermeter.nim b/src/backend_powermeter.nim
@@ -16,7 +16,7 @@ proc updatePowermeter(key: string, device: DeviceConfig) {.async.} =
   broadcast($(%*server.state))
 
 proc updatePowermeters() {.async.} =
-  #GC_fullCollect()
+  GC_fullCollect()
   echo "updating powermeters"
   for key, device in server.config.devices.pairs():
     if device.type != PowerMeter:
diff --git a/src/foo b/src/foo  Binary files differ.
diff --git a/src/foo.nim b/src/foo.nim
@@ -0,0 +1,12 @@
+import asyncdispatch
+
+proc p1() {.async.} =
+  GC_fullCollect()
+  echo "foo"
+
+proc timerFunc(fd: AsyncFD): bool =
+  let fut = p1()
+
+addTimer(1, true, timerFunc)
+
+runForever()
diff --git a/src/modbus.nim b/src/modbus.nim
@@ -47,7 +47,7 @@ proc asyncReadFloat*(mb: modbus, ad: uint8, reg: uint8): Future[float32] {.async
   return await mb.retry(proc (): (cint, float32) =
       var data = [0u32]
       mb.modbus_set_slave(cint(ad))
-      let status = mb.modbus_read_input_registers(cint(reg), 2, data.addr)
+      let status = cint(0) #mb.modbus_read_input_registers(cint(reg), 2, data.addr)
       let res = modbus_get_float_dcba(data.addr)
       return (status, float32(res))
     )

@@ -63,7 +63,7 @@ proc asyncReadBits*(mb: modbus, ad: uint8, reg: uint8, nb: uint8): Future[seq[bo
   var data: array[256, bool]
   discard await mb.retry(proc (): (cint, bool) =
       mb.modbus_set_slave(cint(ad))
-      let status = mb.modbus_read_bits(cint(reg), cint(nb), data.addr)
+      let status = cint(0) #mb.modbus_read_bits(cint(reg), cint(nb), data.addr)
       return (status, false)
     )
   return @data[0..nb-1]