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

Update Plugin_048 Oregon protocols #97

Merged
merged 5 commits into from
Nov 9, 2023
Merged
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
28 changes: 28 additions & 0 deletions RFLink/4_Display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ void display_Name(const char *input)
strcat(pbuffer, dbuffer);
}

void display_NameEx(const char *name, unsigned int id)
{
sprintf_P(dbuffer, PSTR(";%s-%04X"), name, id);
strcat(pbuffer, dbuffer);
}

// Common Footer
void display_Footer(void)
{
Expand Down Expand Up @@ -211,6 +217,13 @@ void display_RAIN(unsigned int input)
strcat(pbuffer, dbuffer);
}

// RAINTOT=1234 => Total rain in mm. (hexadecimal) 0x8d = 141 decimal = 14.1 mm (needs division by 10)
void display_RAINTOT(unsigned int input)
{
sprintf_P(dbuffer, PSTR("%s%04x"), PSTR(";RAINTOT="), input);
strcat(pbuffer, dbuffer);
}

// RAINRATE=1234 => Rain rate in mm. (hexadecimal) 0x8d = 141 decimal = 14.1 mm (needs division by 10)
void display_RAINRATE(unsigned int input)
{
Expand Down Expand Up @@ -358,6 +371,21 @@ void display_CHAN(byte channel)
strcat(pbuffer, dbuffer);
}

// DEBUG=..... => provide DEBUG Data
void display_DEBUG(byte data[], unsigned int size)
{
sprintf_P(dbuffer, PSTR("%s"), PSTR(";DEBUG="));
strcat(pbuffer, dbuffer);

char buffer[size*2 + 1];
for (unsigned int i = 0; i < size; i++)
{
sprintf_P(buffer+i*2, PSTR("%02x"), data[i]);
}

strcat(pbuffer, buffer);
}

// --------------------- //
// get label shared func //
// --------------------- //
Expand Down
3 changes: 3 additions & 0 deletions RFLink/4_Display.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ extern char pbuffer[PRINT_BUFFER_SIZE]; // Buffer for printing data

void display_Header(void);
void display_Name(const char *);
void display_NameEx(const char *name, unsigned int id);
void display_Footer(void);
void display_Splash(void);
void display_IDn(unsigned long, byte);
Expand Down Expand Up @@ -52,6 +53,7 @@ void display_UV(unsigned int);
void display_LUX(unsigned int);
void display_BAT(boolean);
void display_RAIN(unsigned int);
void display_RAINTOT(unsigned int);
void display_RAINRATE(unsigned int);
void display_WINSP(unsigned int);
void display_AWINSP(unsigned int);
Expand Down Expand Up @@ -81,6 +83,7 @@ void display_DIST(unsigned int);
void display_METER(unsigned int);
void display_VOLT(unsigned int);
void display_RGBW(unsigned int);
void display_DEBUG(byte data[], unsigned int size);

// These functions are here to help writing the emitting part of a plugin by interpreting the received command
// A local copy of the original InputBuffer_Serial is split by semi colons into tokens seperated when calling
Expand Down
Loading