mirror of
https://github.com/thelsing/knx.git
synced 2024-12-18 19:08:18 +01:00
move MAX,MIN,ABS to bits.h
This commit is contained in:
parent
f169e20f2f
commit
cddef776f7
@ -46,10 +46,10 @@ KnxFacade<LinuxPlatform, Bau07B0> knx;
|
|||||||
|
|
||||||
long lastsend = 0;
|
long lastsend = 0;
|
||||||
|
|
||||||
#define CURR knx.getGroupObject(1)
|
#define GO_CURR knx.getGroupObject(1)
|
||||||
#define MAX knx.getGroupObject(2)
|
#define GO_MAX knx.getGroupObject(2)
|
||||||
#define MIN knx.getGroupObject(3)
|
#define GO_MIN knx.getGroupObject(3)
|
||||||
#define RESET knx.getGroupObject(4)
|
#define GO_RESET knx.getGroupObject(4)
|
||||||
|
|
||||||
void measureTemp()
|
void measureTemp()
|
||||||
{
|
{
|
||||||
@ -65,22 +65,22 @@ void measureTemp()
|
|||||||
// currentValue *= (670433.28 + 273);
|
// currentValue *= (670433.28 + 273);
|
||||||
// currentValue -= 273;
|
// currentValue -= 273;
|
||||||
println(currentValue);
|
println(currentValue);
|
||||||
CURR.value(currentValue);
|
GO_CURR.value(currentValue);
|
||||||
|
|
||||||
double max = MAX.value();
|
double max = GO_MAX.value();
|
||||||
if (currentValue > max)
|
if (currentValue > max)
|
||||||
MAX.value(currentValue);
|
GO_MAX.value(currentValue);
|
||||||
|
|
||||||
if (currentValue < (double)MIN.value())
|
if (currentValue < (double)GO_MIN.value())
|
||||||
MIN.value(currentValue);
|
GO_MIN.value(currentValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetCallback(GroupObject& go)
|
void resetCallback(GroupObject& go)
|
||||||
{
|
{
|
||||||
if (go.value())
|
if (go.value())
|
||||||
{
|
{
|
||||||
MAX.valueNoSend(-273.0);
|
GO_MAX.valueNoSend(-273.0);
|
||||||
MIN.valueNoSend(670433.28);
|
GO_MIN.valueNoSend(670433.28);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,13 +102,13 @@ void setup()
|
|||||||
|
|
||||||
if (knx.configured())
|
if (knx.configured())
|
||||||
{
|
{
|
||||||
CURR.dataPointType(Dpt(9, 1));
|
GO_CURR.dataPointType(Dpt(9, 1));
|
||||||
MIN.dataPointType(Dpt(9, 1));
|
GO_MIN.dataPointType(Dpt(9, 1));
|
||||||
MIN.value(670433.28);
|
GO_MIN.value(670433.28);
|
||||||
MAX.dataPointType(Dpt(9, 1));
|
GO_MAX.dataPointType(Dpt(9, 1));
|
||||||
MAX.valueNoSend(-273.0);
|
GO_MAX.valueNoSend(-273.0);
|
||||||
RESET.dataPointType(Dpt(1, 15));
|
GO_RESET.dataPointType(Dpt(1, 15));
|
||||||
RESET.callback(resetCallback);
|
GO_RESET.callback(resetCallback);
|
||||||
printf("Timeout: %d\n", knx.paramWord(0));
|
printf("Timeout: %d\n", knx.paramWord(0));
|
||||||
printf("Zykl. senden: %d\n", knx.paramByte(2));
|
printf("Zykl. senden: %d\n", knx.paramByte(2));
|
||||||
printf("Min/Max senden: %d\n", knx.paramByte(3));
|
printf("Min/Max senden: %d\n", knx.paramByte(3));
|
||||||
|
@ -13,6 +13,18 @@
|
|||||||
#define ntohl(x) htonl(x)
|
#define ntohl(x) htonl(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef MIN
|
||||||
|
#define MIN(a, b) ((a < b) ? (a) : (b))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef MAX
|
||||||
|
#define MAX(a, b) ((a > b) ? (a) : (b))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ABS
|
||||||
|
#define ABS(x) ((x > 0) ? (x) : (-x))
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_STM32)
|
#if defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_STM32)
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#elif defined(ARDUINO_ARCH_ESP8266)
|
#elif defined(ARDUINO_ARCH_ESP8266)
|
||||||
|
@ -12,10 +12,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define MIN(a, b) ((a < b) ? (a) : (b))
|
|
||||||
#define MAX(a, b) ((a > b) ? (a) : (b))
|
|
||||||
#define ABS(x) ((x > 0) ? (x) : (-x))
|
|
||||||
|
|
||||||
// Table for encoding 4-bit data into a 8-bit Manchester encoding.
|
// Table for encoding 4-bit data into a 8-bit Manchester encoding.
|
||||||
const uint8_t RfPhysicalLayerCC1101::manchEncodeTab[16] = {0xAA, // 0x0 Manchester encoded
|
const uint8_t RfPhysicalLayerCC1101::manchEncodeTab[16] = {0xAA, // 0x0 Manchester encoded
|
||||||
0xA9, // 0x1 Manchester encoded
|
0xA9, // 0x1 Manchester encoded
|
||||||
|
Loading…
Reference in New Issue
Block a user