From c5bf61a44ff8a1c7ade72b0f7d6d64f109c686f4 Mon Sep 17 00:00:00 2001 From: Thomas Kunze Date: Mon, 15 Jul 2019 21:32:00 +0200 Subject: [PATCH] fix coredump --- knx-linux/main.cpp | 6 ++++-- src/knx/platform.cpp | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/knx-linux/main.cpp b/knx-linux/main.cpp index 828e31b..e84b3c6 100644 --- a/knx-linux/main.cpp +++ b/knx-linux/main.cpp @@ -25,8 +25,10 @@ void measureTemp() lastsend = now; int r = rand(); double currentValue = (r * 1.0) / (RAND_MAX * 1.0); - currentValue *= (670433.28 + 273); - currentValue -= 273; + currentValue *= 100; + currentValue -= 50; + // currentValue *= (670433.28 + 273); + // currentValue -= 273; println(currentValue); CURR.value(currentValue); diff --git a/src/knx/platform.cpp b/src/knx/platform.cpp index 496ef6f..53eeaa9 100644 --- a/src/knx/platform.cpp +++ b/src/knx/platform.cpp @@ -31,9 +31,10 @@ void Platform::freeMemory(uint8_t* ptr) Platform::Platform() { - // allocate memory to have a memory reference, substract a bit - _memoryReference = (uint8_t*)malloc(1) - 1024; + // allocate memory to have a memory reference, substract a bit + _memoryReference = (uint8_t*)malloc(1); free(_memoryReference); - print("MemRef: "); + _memoryReference -= 1024; + print("MemRef: "); println((long unsigned int)_memoryReference, HEX); }