Skip to content

Commit

Permalink
Merge pull request #97 from cpainchaud/cpainchaud-oregon-patch
Browse files Browse the repository at this point in the history
Update Plugin_048 Oregon protocols
  • Loading branch information
cpainchaud authored Nov 9, 2023
2 parents 1773b1d + c5bc83a commit b4c982d
Show file tree
Hide file tree
Showing 5 changed files with 1,000 additions and 1,126 deletions.
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

0 comments on commit b4c982d

Please sign in to comment.