mirror of
https://github.com/thelsing/knx.git
synced 2026-02-23 13:50:35 +01:00
fix build; add debug output
This commit is contained in:
@@ -174,11 +174,11 @@ size_t EspPlatform::readBytesUart(uint8_t *buffer, size_t length)
|
||||
|
||||
void print(const char* s)
|
||||
{
|
||||
printf("%s", s);
|
||||
Serial.printf("%s", s);
|
||||
}
|
||||
void print(char c)
|
||||
{
|
||||
printf("%c", c);
|
||||
Serial.printf("%c", c);
|
||||
}
|
||||
|
||||
void print(unsigned char num)
|
||||
@@ -189,9 +189,9 @@ void print(unsigned char num)
|
||||
void print(unsigned char num, int base)
|
||||
{
|
||||
if (base == HEX)
|
||||
printf("%X", num);
|
||||
Serial.printf("%X", num);
|
||||
else
|
||||
printf("%d", num);
|
||||
Serial.printf("%d", num);
|
||||
}
|
||||
|
||||
void print(int num)
|
||||
@@ -202,9 +202,9 @@ void print(int num)
|
||||
void print(int num, int base)
|
||||
{
|
||||
if (base == HEX)
|
||||
printf("%X", num);
|
||||
Serial.printf("%X", num);
|
||||
else
|
||||
printf("%d", num);
|
||||
Serial.printf("%d", num);
|
||||
}
|
||||
|
||||
void print(unsigned int num)
|
||||
@@ -215,9 +215,9 @@ void print(unsigned int num)
|
||||
void print(unsigned int num, int base)
|
||||
{
|
||||
if (base == HEX)
|
||||
printf("%X", num);
|
||||
Serial.printf("%X", num);
|
||||
else
|
||||
printf("%d", num);
|
||||
Serial.printf("%d", num);
|
||||
}
|
||||
|
||||
void print(long num)
|
||||
@@ -228,9 +228,9 @@ void print(long num)
|
||||
void print(long num, int base)
|
||||
{
|
||||
if (base == HEX)
|
||||
printf("%lX", num);
|
||||
Serial.printf("%lX", num);
|
||||
else
|
||||
printf("%ld", num);
|
||||
Serial.printf("%ld", num);
|
||||
}
|
||||
|
||||
void print(unsigned long num)
|
||||
@@ -241,23 +241,23 @@ void print(unsigned long num)
|
||||
void print(unsigned long num, int base)
|
||||
{
|
||||
if (base == HEX)
|
||||
printf("%lX", num);
|
||||
Serial.printf("%lX", num);
|
||||
else
|
||||
printf("%ld", num);
|
||||
Serial.printf("%ld", num);
|
||||
}
|
||||
|
||||
void print(double num)
|
||||
{
|
||||
printf("%f", num);
|
||||
Serial.printf("%f", num);
|
||||
}
|
||||
|
||||
void println(const char* s)
|
||||
{
|
||||
printf("%s\n", s);
|
||||
Serial.printf("%s\n", s);
|
||||
}
|
||||
void println(char c)
|
||||
{
|
||||
printf("%c\n", c);
|
||||
Serial.printf("%c\n", c);
|
||||
}
|
||||
|
||||
void println(unsigned char num)
|
||||
@@ -268,9 +268,9 @@ void println(unsigned char num)
|
||||
void println(unsigned char num, int base)
|
||||
{
|
||||
if (base == HEX)
|
||||
printf("%X\n", num);
|
||||
Serial.printf("%X\n", num);
|
||||
else
|
||||
printf("%d\n", num);
|
||||
Serial.printf("%d\n", num);
|
||||
}
|
||||
|
||||
void println(int num)
|
||||
@@ -281,9 +281,9 @@ void println(int num)
|
||||
void println(int num, int base)
|
||||
{
|
||||
if (base == HEX)
|
||||
printf("%X\n", num);
|
||||
Serial.printf("%X\n", num);
|
||||
else
|
||||
printf("%d\n", num);
|
||||
Serial.printf("%d\n", num);
|
||||
}
|
||||
|
||||
void println(unsigned int num)
|
||||
@@ -294,9 +294,9 @@ void println(unsigned int num)
|
||||
void println(unsigned int num, int base)
|
||||
{
|
||||
if (base == HEX)
|
||||
printf("%X\n", num);
|
||||
Serial.printf("%X\n", num);
|
||||
else
|
||||
printf("%d\n", num);
|
||||
Serial.printf("%d\n", num);
|
||||
}
|
||||
|
||||
void println(long num)
|
||||
@@ -307,9 +307,9 @@ void println(long num)
|
||||
void println(long num, int base)
|
||||
{
|
||||
if (base == HEX)
|
||||
printf("%lX\n", num);
|
||||
Serial.printf("%lX\n", num);
|
||||
else
|
||||
printf("%ld\n", num);
|
||||
Serial.printf("%ld\n", num);
|
||||
}
|
||||
|
||||
void println(unsigned long num)
|
||||
@@ -320,18 +320,18 @@ void println(unsigned long num)
|
||||
void println(unsigned long num, int base)
|
||||
{
|
||||
if (base == HEX)
|
||||
printf("%lX\n", num);
|
||||
Serial.printf("%lX\n", num);
|
||||
else
|
||||
printf("%ld\n", num);
|
||||
Serial.printf("%ld\n", num);
|
||||
}
|
||||
|
||||
void println(double num)
|
||||
{
|
||||
printf("%f\n", num);
|
||||
Serial.printf("%f\n", num);
|
||||
}
|
||||
|
||||
void println(void)
|
||||
{
|
||||
printf("\n");
|
||||
Serial.printf("\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "platform.h"
|
||||
#include "knx/bits.h"
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
@@ -13,7 +14,12 @@ uint8_t* Platform::allocMemory(size_t size)
|
||||
uint8_t* address = (uint8_t*)malloc(size);
|
||||
// if (_memoryReference == 0 || address < _memoryReference)
|
||||
// _memoryReference = address;
|
||||
|
||||
print("MemRef: ");
|
||||
print((long unsigned int)_memoryReference, HEX);
|
||||
print(" Mem: ");
|
||||
print((long unsigned int)address, HEX);
|
||||
print(" Diff: ");
|
||||
println((long unsigned int)(address - _memoryReference));
|
||||
return address;
|
||||
}
|
||||
|
||||
@@ -25,7 +31,9 @@ void Platform::freeMemory(uint8_t* ptr)
|
||||
|
||||
Platform::Platform()
|
||||
{
|
||||
// allocate memory to have a memory reference
|
||||
_memoryReference = (uint8_t*)malloc(1);
|
||||
// allocate memory to have a memory reference, substract a bit
|
||||
_memoryReference = (uint8_t*)malloc(1) - 1024;
|
||||
free(_memoryReference);
|
||||
print("MemRef: ");
|
||||
println((long unsigned int)_memoryReference, HEX);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#ifdef ARDUINO_ARCH_SAMD
|
||||
SamdPlatform platform;
|
||||
Bau07B0 bau(platform);
|
||||
#define ICACHE_RAM_ATTR
|
||||
#elif ARDUINO_ARCH_ESP8266
|
||||
EspPlatform platform;
|
||||
Bau57B0 bau(platform);
|
||||
@@ -15,9 +16,9 @@ Bau57B0 bau(platform);
|
||||
#define attachInterrupt(a, b, c)
|
||||
#endif
|
||||
|
||||
bool _toogleProgMode = false;
|
||||
#ifndef __linux__
|
||||
KnxFacade knx(bau);
|
||||
bool _toogleProgMode = false;
|
||||
ICACHE_RAM_ATTR void buttonUp()
|
||||
{
|
||||
_toogleProgMode = true;
|
||||
@@ -110,7 +111,7 @@ void KnxFacade::loop()
|
||||
{
|
||||
if(_toogleProgMode)
|
||||
{
|
||||
knx.progMode(!knx.progMode());
|
||||
progMode(!progMode());
|
||||
_toogleProgMode = false;
|
||||
}
|
||||
_bau.loop();
|
||||
|
||||
Reference in New Issue
Block a user