Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add KNoT Type IDs: acceleration and angular velocity #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/knot_protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@
UNIT_MASK(KNOT_UNIT_ENERGY_CAL) | \
UNIT_MASK(KNOT_UNIT_ENERGY_KCAL))

#define UNIT_ACCELERATION_MASK (UNIT_MASK(KNOT_UNIT_ACCELERATION_MS2))

#define UNIT_ANG_VEL_MASK (UNIT_MASK(KNOT_UNIT_ANGULAR_VELOCITY_RADSEG) | \
UNIT_MASK(KNOT_UNIT_ANGULAR_VELOCITY_DEGSEG))

#define TYPE_ID_MASK(type) (type & 0x000F)

static const struct schema {
Expand Down Expand Up @@ -123,7 +128,9 @@ static const struct schema {
{KNOT_VALUE_TYPE_FLOAT, UNIT_LONG_MASK },
{KNOT_VALUE_TYPE_INT, UNIT_SPEED_MASK },
{KNOT_VALUE_TYPE_FLOAT, UNIT_VOLFLOW_MASK },
{KNOT_VALUE_TYPE_INT, UNIT_ENERGY_MASK }
{KNOT_VALUE_TYPE_INT, UNIT_ENERGY_MASK },
{KNOT_VALUE_TYPE_FLOAT, UNIT_ACCELERATION_MASK },
{KNOT_VALUE_TYPE_FLOAT, UNIT_ANG_VEL_MASK}
};

static const uint8_t logic_types[] = {
Expand Down
7 changes: 6 additions & 1 deletion src/knot_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@
#define KNOT_TYPE_ID_SPEED 0x0013
#define KNOT_TYPE_ID_VOLUMEFLOW 0x0014
#define KNOT_TYPE_ID_ENERGY 0x0015
#define KNOT_TYPE_ID_ACCELERATION 0x0016
#define KNOT_TYPE_ID_ANGULAR_VELOCITY 0x0017

// MAX TypeID for basic units
#define KNOT_TYPE_ID_BASIC_MAX (KNOT_TYPE_ID_ENERGY+1)
#define KNOT_TYPE_ID_BASIC_MAX (KNOT_TYPE_ID_ANGULAR_VELOCITY+1)

// TypeIDs for logical units
#define KNOT_TYPE_ID_PRESENCE 0xFFF0
Expand Down Expand Up @@ -127,6 +129,9 @@
#define KNOT_UNIT_ENERGY_KWH 0x04
#define KNOT_UNIT_ENERGY_CAL 0x05
#define KNOT_UNIT_ENERGY_KCAL 0x06
#define KNOT_UNIT_ACCELERATION_MS2 0X01
#define KNOT_UNIT_ANGULAR_VELOCITY_RADSEG 0X01
#define KNOT_UNIT_ANGULAR_VELOCITY_DEGSEG 0X02

// definition of value type
#define KNOT_VALUE_TYPE_INT 0x01
Expand Down