Add #ifdef BOARD_NODEMCU32S_OBP60 in all *.cpp
This commit is contained in:
parent
86ab6e9177
commit
5e61754b08
|
@ -1,3 +1,4 @@
|
||||||
|
#ifdef BOARD_NODEMCU32S_OBP60
|
||||||
|
|
||||||
/****************************************************
|
/****************************************************
|
||||||
AMS 5600 class for Arduino platform
|
AMS 5600 class for Arduino platform
|
||||||
|
@ -458,3 +459,5 @@ void AMS_5600::writeOneByte(int adr_in, int dat_in)
|
||||||
}
|
}
|
||||||
|
|
||||||
/********** END OF AMS 5600 CALSS *****************/
|
/********** END OF AMS 5600 CALSS *****************/
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,3 +1,5 @@
|
||||||
|
#ifdef BOARD_NODEMCU32S_OBP60
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "Pagedata.h"
|
#include "Pagedata.h"
|
||||||
#include "OBP60Hardware.h"
|
#include "OBP60Hardware.h"
|
||||||
|
@ -201,3 +203,5 @@ void displayHeader(CommonData &commonData, GwApi::BoatValue *hdop, GwApi::BoatVa
|
||||||
display.print("No GPS data");
|
display.print("No GPS data");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,3 +1,5 @@
|
||||||
|
#ifdef BOARD_NODEMCU32S_OBP60
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "GwApi.h"
|
#include "GwApi.h"
|
||||||
#include "Pagedata.h"
|
#include "Pagedata.h"
|
||||||
|
@ -431,3 +433,5 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
result.svalue = String(buffer);
|
result.svalue = String(buffer);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -14,11 +14,13 @@
|
||||||
// BME280
|
// BME280
|
||||||
#define BME280_I2C_ADDR 0x76 // Addr. 0x76 (0x77)
|
#define BME280_I2C_ADDR 0x76 // Addr. 0x76 (0x77)
|
||||||
// BMP280
|
// BMP280
|
||||||
#define BMP280_I2C_ADDR 0x77 // Addr. 0x77
|
#define BMP280_I2C_ADDR 0x76 // Addr. 0x76 (0x77)
|
||||||
// BMP085 / BMP180
|
// BMP085 / BMP180
|
||||||
#define BMP280_I2C_ADDR 0x77 // Addr. 0x77 (fix)
|
#define BMP180_I2C_ADDR 0x77 // Addr. 0x77 (fix)
|
||||||
// SHT21 / HUT21
|
// SHT21 / HUT21
|
||||||
#define SHT21_I2C_ADDR 0x40 // Addr. 0x40 (fix)
|
#define SHT21_I2C_ADDR 0x40 // Addr. 0x40 (fix)
|
||||||
|
// AS5600
|
||||||
|
#define AS5600_I2C_ADDR 0x36 // Addr. 0x36 (fix)
|
||||||
// SPI (E-Ink display, Extern Bus)
|
// SPI (E-Ink display, Extern Bus)
|
||||||
#define OBP_SPI_CS 5
|
#define OBP_SPI_CS 5
|
||||||
#define OBP_SPI_DC 17
|
#define OBP_SPI_DC 17
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#ifdef BOARD_NODEMCU32S_OBP60
|
||||||
|
|
||||||
#include "Pagedata.h"
|
#include "Pagedata.h"
|
||||||
#include "OBP60ExtensionPort.h"
|
#include "OBP60ExtensionPort.h"
|
||||||
|
|
||||||
|
@ -200,3 +202,5 @@ PageDescription registerPageApparentWind(
|
||||||
{"AWS","AWA"}, // Bus values we need in the page
|
{"AWS","AWA"}, // Bus values we need in the page
|
||||||
true // Show display header on/off
|
true // Show display header on/off
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,3 +1,5 @@
|
||||||
|
#ifdef BOARD_NODEMCU32S_OBP60
|
||||||
|
|
||||||
#include "Pagedata.h"
|
#include "Pagedata.h"
|
||||||
#include "OBP60ExtensionPort.h"
|
#include "OBP60ExtensionPort.h"
|
||||||
|
|
||||||
|
@ -228,3 +230,5 @@ PageDescription registerPageBME280(
|
||||||
{}, // Names of bus values undepends on selection in Web configuration (refer GwBoatData.h)
|
{}, // Names of bus values undepends on selection in Web configuration (refer GwBoatData.h)
|
||||||
true // Show display header on/off
|
true // Show display header on/off
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,3 +1,5 @@
|
||||||
|
#ifdef BOARD_NODEMCU32S_OBP60
|
||||||
|
|
||||||
#include "Pagedata.h"
|
#include "Pagedata.h"
|
||||||
#include "OBP60ExtensionPort.h"
|
#include "OBP60ExtensionPort.h"
|
||||||
|
|
||||||
|
@ -187,17 +189,17 @@ public:
|
||||||
//*******************************************************************************************
|
//*******************************************************************************************
|
||||||
|
|
||||||
// Draw clock
|
// Draw clock
|
||||||
int rWindGraphic = 110; // Radius of clock
|
int rInstrument = 110; // Radius of clock
|
||||||
float pi = 3.141592;
|
float pi = 3.141592;
|
||||||
|
|
||||||
display.fillCircle(200, 150, rWindGraphic + 10, pixelcolor); // Outer circle
|
display.fillCircle(200, 150, rInstrument + 10, pixelcolor); // Outer circle
|
||||||
display.fillCircle(200, 150, rWindGraphic + 7, bgcolor); // Outer circle
|
display.fillCircle(200, 150, rInstrument + 7, bgcolor); // Outer circle
|
||||||
|
|
||||||
for(int i=0; i<360; i=i+10)
|
for(int i=0; i<360; i=i+10)
|
||||||
{
|
{
|
||||||
// Scaling values
|
// Scaling values
|
||||||
float x = 200 + (rWindGraphic-30)*sin(i/180.0*pi); // x-coordinate dots
|
float x = 200 + (rInstrument-30)*sin(i/180.0*pi); // x-coordinate dots
|
||||||
float y = 150 - (rWindGraphic-30)*cos(i/180.0*pi); // y-coordinate cots
|
float y = 150 - (rInstrument-30)*cos(i/180.0*pi); // y-coordinate cots
|
||||||
const char *ii = "";
|
const char *ii = "";
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
|
@ -227,8 +229,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw sub scale with dots
|
// Draw sub scale with dots
|
||||||
float x1c = 200 + rWindGraphic*sin(i/180.0*pi);
|
float x1c = 200 + rInstrument*sin(i/180.0*pi);
|
||||||
float y1c = 150 - rWindGraphic*cos(i/180.0*pi);
|
float y1c = 150 - rInstrument*cos(i/180.0*pi);
|
||||||
display.fillCircle((int)x1c, (int)y1c, 2, pixelcolor);
|
display.fillCircle((int)x1c, (int)y1c, 2, pixelcolor);
|
||||||
float sinx=sin(i/180.0*pi);
|
float sinx=sin(i/180.0*pi);
|
||||||
float cosx=cos(i/180.0*pi);
|
float cosx=cos(i/180.0*pi);
|
||||||
|
@ -238,8 +240,8 @@ public:
|
||||||
float dx=2; // Line thickness = 2*dx+1
|
float dx=2; // Line thickness = 2*dx+1
|
||||||
float xx1 = -dx;
|
float xx1 = -dx;
|
||||||
float xx2 = +dx;
|
float xx2 = +dx;
|
||||||
float yy1 = -(rWindGraphic-10);
|
float yy1 = -(rInstrument-10);
|
||||||
float yy2 = -(rWindGraphic+10);
|
float yy2 = -(rInstrument+10);
|
||||||
display.fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
display.fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||||
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||||
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),pixelcolor);
|
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),pixelcolor);
|
||||||
|
@ -280,7 +282,7 @@ public:
|
||||||
float xx1 = -startwidth;
|
float xx1 = -startwidth;
|
||||||
float xx2 = startwidth;
|
float xx2 = startwidth;
|
||||||
float yy1 = -startwidth;
|
float yy1 = -startwidth;
|
||||||
float yy2 = -(rWindGraphic * 0.5);
|
float yy2 = -(rInstrument * 0.5);
|
||||||
display.fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
display.fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||||
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||||
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor);
|
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor);
|
||||||
|
@ -289,7 +291,7 @@ public:
|
||||||
float endwidth = 2; // End width of pointer
|
float endwidth = 2; // End width of pointer
|
||||||
float ix1 = endwidth;
|
float ix1 = endwidth;
|
||||||
float ix2 = -endwidth;
|
float ix2 = -endwidth;
|
||||||
float iy1 = -(rWindGraphic * 0.5);
|
float iy1 = -(rInstrument * 0.5);
|
||||||
float iy2 = -endwidth;
|
float iy2 = -endwidth;
|
||||||
display.fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
display.fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
||||||
200+(int)(cosx*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
|
200+(int)(cosx*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
|
||||||
|
@ -306,7 +308,7 @@ public:
|
||||||
float xx1 = -startwidth;
|
float xx1 = -startwidth;
|
||||||
float xx2 = startwidth;
|
float xx2 = startwidth;
|
||||||
float yy1 = -startwidth;
|
float yy1 = -startwidth;
|
||||||
float yy2 = -(rWindGraphic - 15);
|
float yy2 = -(rInstrument - 15);
|
||||||
display.fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
display.fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||||
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||||
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor);
|
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor);
|
||||||
|
@ -315,7 +317,7 @@ public:
|
||||||
float endwidth = 2; // End width of pointer
|
float endwidth = 2; // End width of pointer
|
||||||
float ix1 = endwidth;
|
float ix1 = endwidth;
|
||||||
float ix2 = -endwidth;
|
float ix2 = -endwidth;
|
||||||
float iy1 = -(rWindGraphic - 15);
|
float iy1 = -(rInstrument - 15);
|
||||||
float iy2 = -endwidth;
|
float iy2 = -endwidth;
|
||||||
display.fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
display.fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
||||||
200+(int)(cosx*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
|
200+(int)(cosx*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
|
||||||
|
@ -365,3 +367,5 @@ PageDescription registerPageClock(
|
||||||
{"GPST", "GPSD"}, // Bus values we need in the page
|
{"GPST", "GPSD"}, // Bus values we need in the page
|
||||||
true // Show display header on/off
|
true // Show display header on/off
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,3 +1,5 @@
|
||||||
|
#ifdef BOARD_NODEMCU32S_OBP60
|
||||||
|
|
||||||
#include "Pagedata.h"
|
#include "Pagedata.h"
|
||||||
#include "OBP60ExtensionPort.h"
|
#include "OBP60ExtensionPort.h"
|
||||||
|
|
||||||
|
@ -300,3 +302,5 @@ PageDescription registerPageDST810(
|
||||||
{"DBT","STW","Log","WTemp"}, // Bus values we need in the page
|
{"DBT","STW","Log","WTemp"}, // Bus values we need in the page
|
||||||
true // Show display header on/off
|
true // Show display header on/off
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,3 +1,5 @@
|
||||||
|
#ifdef BOARD_NODEMCU32S_OBP60
|
||||||
|
|
||||||
#include "Pagedata.h"
|
#include "Pagedata.h"
|
||||||
#include "OBP60ExtensionPort.h"
|
#include "OBP60ExtensionPort.h"
|
||||||
|
|
||||||
|
@ -339,3 +341,5 @@ PageDescription registerPageForValues(
|
||||||
4, // Number of bus values depends on selection in Web configuration
|
4, // Number of bus values depends on selection in Web configuration
|
||||||
true // Show display header on/off
|
true // Show display header on/off
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,3 +1,5 @@
|
||||||
|
#ifdef BOARD_NODEMCU32S_OBP60
|
||||||
|
|
||||||
#include "Pagedata.h"
|
#include "Pagedata.h"
|
||||||
#include "OBP60ExtensionPort.h"
|
#include "OBP60ExtensionPort.h"
|
||||||
|
|
||||||
|
@ -339,3 +341,5 @@ PageDescription registerPageForValues2(
|
||||||
4, // Number of bus values depends on selection in Web configuration
|
4, // Number of bus values depends on selection in Web configuration
|
||||||
true // Show display header on/off
|
true // Show display header on/off
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,245 @@
|
||||||
|
#ifdef BOARD_NODEMCU32S_OBP60
|
||||||
|
|
||||||
|
#include "Pagedata.h"
|
||||||
|
#include "OBP60ExtensionPort.h"
|
||||||
|
|
||||||
|
class PageKeelPosition : public Page
|
||||||
|
{
|
||||||
|
bool keylock = false; // Keylock
|
||||||
|
|
||||||
|
public:
|
||||||
|
PageKeelPosition(CommonData &common){
|
||||||
|
common.logger->logDebug(GwLog::LOG,"Show PageKeelPosition");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Key functions
|
||||||
|
virtual int handleKey(int key){
|
||||||
|
// Keylock function
|
||||||
|
if(key == 11){ // Code for keylock
|
||||||
|
keylock = !keylock; // Toggle keylock
|
||||||
|
return 0; // Commit the key
|
||||||
|
}
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void displayPage(CommonData &commonData, PageData &pageData)
|
||||||
|
{
|
||||||
|
GwConfigHandler *config = commonData.config;
|
||||||
|
GwLog *logger=commonData.logger;
|
||||||
|
|
||||||
|
double value1 = 0;
|
||||||
|
double value1old = 0;
|
||||||
|
|
||||||
|
// Get config data
|
||||||
|
String lengthformat = config->getString(config->lengthFormat);
|
||||||
|
bool simulation = config->getBool(config->useSimuData);
|
||||||
|
String displaycolor = config->getString(config->displaycolor);
|
||||||
|
bool holdvalues = config->getBool(config->holdvalues);
|
||||||
|
String flashLED = config->getString(config->flashLED);
|
||||||
|
String backlightMode = config->getString(config->backlight);
|
||||||
|
|
||||||
|
// Get boat values for Keel position
|
||||||
|
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list
|
||||||
|
value1 = commonData.data.rotationAngle; // Raw value without unit convertion
|
||||||
|
bool valid1 = commonData.data.validRotAngle; // Valid information
|
||||||
|
String unit1 = "Deg"; // Unit of value
|
||||||
|
if(valid1 == true){
|
||||||
|
value1old = value1; // Save old value
|
||||||
|
}
|
||||||
|
|
||||||
|
// Optical warning by limit violation (unused)
|
||||||
|
if(String(flashLED) == "Limit Violation"){
|
||||||
|
setBlinkingLED(false);
|
||||||
|
setPortPin(OBP_FLASH_LED, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Logging boat values
|
||||||
|
if (bvalue1 == NULL) return;
|
||||||
|
LOG_DEBUG(GwLog::LOG,"Drawing at PageKeelPosition, Keel:%f", value1);
|
||||||
|
|
||||||
|
// Draw page
|
||||||
|
//***********************************************************
|
||||||
|
|
||||||
|
// Set background color and text color
|
||||||
|
int textcolor = GxEPD_BLACK;
|
||||||
|
int pixelcolor = GxEPD_BLACK;
|
||||||
|
int bgcolor = GxEPD_WHITE;
|
||||||
|
if(displaycolor == "Normal"){
|
||||||
|
textcolor = GxEPD_BLACK;
|
||||||
|
pixelcolor = GxEPD_BLACK;
|
||||||
|
bgcolor = GxEPD_WHITE;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
textcolor = GxEPD_WHITE;
|
||||||
|
pixelcolor = GxEPD_WHITE;
|
||||||
|
bgcolor = GxEPD_BLACK;
|
||||||
|
}
|
||||||
|
// Clear display by call in obp60task.cpp in main loop
|
||||||
|
|
||||||
|
|
||||||
|
//*******************************************************************************************
|
||||||
|
|
||||||
|
// Draw KeelPosition
|
||||||
|
int rInstrument = 110; // Radius of KeelPosition
|
||||||
|
float pi = 3.141592;
|
||||||
|
|
||||||
|
display.fillCircle(200, 150, rInstrument + 10, pixelcolor); // Outer circle
|
||||||
|
display.fillCircle(200, 150, rInstrument + 7, bgcolor); // Outer circle
|
||||||
|
display.fillRect(0, 30, 400, 122, bgcolor); // Delete half top circle
|
||||||
|
|
||||||
|
for(int i=90; i<=270; i=i+10)
|
||||||
|
{
|
||||||
|
// Scaling values
|
||||||
|
float x = 200 + (rInstrument-30)*sin(i/180.0*pi); // x-coordinate dots
|
||||||
|
float y = 150 - (rInstrument-30)*cos(i/180.0*pi); // y-coordinate cots
|
||||||
|
const char *ii = " ";
|
||||||
|
switch (i)
|
||||||
|
{
|
||||||
|
case 0: ii=" "; break; // Use a blank for a empty scale value
|
||||||
|
case 30 : ii=" "; break;
|
||||||
|
case 60 : ii=" "; break;
|
||||||
|
case 90 : ii="45"; break;
|
||||||
|
case 120 : ii="30"; break;
|
||||||
|
case 150 : ii="15"; break;
|
||||||
|
case 180 : ii="0"; break;
|
||||||
|
case 210 : ii="15"; break;
|
||||||
|
case 240 : ii="30"; break;
|
||||||
|
case 270 : ii="45"; break;
|
||||||
|
case 300 : ii=" "; break;
|
||||||
|
case 330 : ii=" "; break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print text centered on position x, y
|
||||||
|
int16_t x1, y1; // Return values of getTextBounds
|
||||||
|
uint16_t w, h; // Return values of getTextBounds
|
||||||
|
display.getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string
|
||||||
|
display.setCursor(x-w/2, y+h/2);
|
||||||
|
if(i % 30 == 0){
|
||||||
|
display.setFont(&Ubuntu_Bold8pt7b);
|
||||||
|
display.print(ii);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw sub scale with dots
|
||||||
|
float x1c = 200 + rInstrument*sin(i/180.0*pi);
|
||||||
|
float y1c = 150 - rInstrument*cos(i/180.0*pi);
|
||||||
|
display.fillCircle((int)x1c, (int)y1c, 2, pixelcolor);
|
||||||
|
float sinx=sin(i/180.0*pi);
|
||||||
|
float cosx=cos(i/180.0*pi);
|
||||||
|
|
||||||
|
// Draw sub scale with lines (two triangles)
|
||||||
|
if(i % 30 == 0){
|
||||||
|
float dx=2; // Line thickness = 2*dx+1
|
||||||
|
float xx1 = -dx;
|
||||||
|
float xx2 = +dx;
|
||||||
|
float yy1 = -(rInstrument-10);
|
||||||
|
float yy2 = -(rInstrument+10);
|
||||||
|
display.fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||||
|
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||||
|
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),pixelcolor);
|
||||||
|
display.fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||||
|
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),
|
||||||
|
200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),pixelcolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print label
|
||||||
|
display.setTextColor(textcolor);
|
||||||
|
display.setFont(&Ubuntu_Bold16pt7b);
|
||||||
|
display.setCursor(100, 70);
|
||||||
|
display.print("Keel Position"); // Label
|
||||||
|
|
||||||
|
// Print Unit of keel position
|
||||||
|
display.setFont(&Ubuntu_Bold12pt7b);
|
||||||
|
display.setCursor(175, 110);
|
||||||
|
display.print(unit1); // Unit
|
||||||
|
|
||||||
|
// Angle limits to +/-45°
|
||||||
|
if(value1 < (-PI / 4)){
|
||||||
|
value1 = -PI / 4;
|
||||||
|
}
|
||||||
|
if(value1 > (PI / 4)){
|
||||||
|
value1 = PI / 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate keel position
|
||||||
|
value1 = (value1 * 2) + PI;
|
||||||
|
|
||||||
|
// Draw keel position pointer
|
||||||
|
float startwidth = 8; // Start width of pointer
|
||||||
|
|
||||||
|
if(valid1 == true || holdvalues == true || simulation == true){
|
||||||
|
float sinx=sin(value1);
|
||||||
|
float cosx=cos(value1);
|
||||||
|
// Normal pointer
|
||||||
|
// Pointer as triangle with center base 2*width
|
||||||
|
float xx1 = -startwidth;
|
||||||
|
float xx2 = startwidth;
|
||||||
|
float yy1 = -startwidth;
|
||||||
|
float yy2 = -(rInstrument * 0.6);
|
||||||
|
display.fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||||
|
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||||
|
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor);
|
||||||
|
// Inverted pointer
|
||||||
|
// Pointer as triangle with center base 2*width
|
||||||
|
float endwidth = 2; // End width of pointer
|
||||||
|
float ix1 = endwidth;
|
||||||
|
float ix2 = -endwidth;
|
||||||
|
float iy1 = -(rInstrument * 0.6);
|
||||||
|
float iy2 = -endwidth;
|
||||||
|
display.fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
||||||
|
200+(int)(cosx*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
|
||||||
|
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),pixelcolor);
|
||||||
|
|
||||||
|
// Draw counterweight
|
||||||
|
display.fillCircle(200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2), 5, pixelcolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Center circle
|
||||||
|
display.fillCircle(200, 150, startwidth + 22, bgcolor);
|
||||||
|
display.fillCircle(200, 150, startwidth + 20, pixelcolor);
|
||||||
|
display.fillRect(200 - 30, 150 - 30, 2 * 30, 30, bgcolor); // Delete half top circle
|
||||||
|
|
||||||
|
|
||||||
|
//*******************************************************************************************
|
||||||
|
// Key Layout
|
||||||
|
display.setTextColor(textcolor);
|
||||||
|
display.setFont(&Ubuntu_Bold8pt7b);
|
||||||
|
display.setCursor(130, 290);
|
||||||
|
if(keylock == false){
|
||||||
|
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||||
|
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||||
|
display.setCursor(343, 290);
|
||||||
|
display.print("[ILUM]");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
display.print(" [ Keylock active ]");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update display
|
||||||
|
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast)
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
static Page *createPage(CommonData &common){
|
||||||
|
return new PageKeelPosition(common);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* with the code below we make this page known to the PageTask
|
||||||
|
* we give it a type (name) that can be selected in the config
|
||||||
|
* we define which function is to be called
|
||||||
|
* and we provide the number of user parameters we expect (0 here)
|
||||||
|
* and will will provide the names of the fixed values we need
|
||||||
|
*/
|
||||||
|
PageDescription registerPageKeelPosition(
|
||||||
|
"KeelPosition", // Page name
|
||||||
|
createPage, // Action
|
||||||
|
0, // Number of bus values depends on selection in Web configuration
|
||||||
|
{"RPOS"}, // Bus values we need in the page
|
||||||
|
true // Show display header on/off
|
||||||
|
);
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,3 +1,5 @@
|
||||||
|
#ifdef BOARD_NODEMCU32S_OBP60
|
||||||
|
|
||||||
#include "Pagedata.h"
|
#include "Pagedata.h"
|
||||||
#include "OBP60ExtensionPort.h"
|
#include "OBP60ExtensionPort.h"
|
||||||
|
|
||||||
|
@ -152,3 +154,5 @@ PageDescription registerPageOneValue(
|
||||||
1, // Number of bus values depends on selection in Web configuration
|
1, // Number of bus values depends on selection in Web configuration
|
||||||
true // Show display header on/off
|
true // Show display header on/off
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,3 +1,5 @@
|
||||||
|
#ifdef BOARD_NODEMCU32S_OBP60
|
||||||
|
|
||||||
#include "Pagedata.h"
|
#include "Pagedata.h"
|
||||||
#include "OBP60ExtensionPort.h"
|
#include "OBP60ExtensionPort.h"
|
||||||
|
|
||||||
|
@ -83,18 +85,18 @@ public:
|
||||||
//*******************************************************************************************
|
//*******************************************************************************************
|
||||||
|
|
||||||
// Draw RudderPosition
|
// Draw RudderPosition
|
||||||
int rWindGraphic = 110; // Radius of RudderPosition
|
int rInstrument = 110; // Radius of RudderPosition
|
||||||
float pi = 3.141592;
|
float pi = 3.141592;
|
||||||
|
|
||||||
display.fillCircle(200, 150, rWindGraphic + 10, pixelcolor); // Outer circle
|
display.fillCircle(200, 150, rInstrument + 10, pixelcolor); // Outer circle
|
||||||
display.fillCircle(200, 150, rWindGraphic + 7, bgcolor); // Outer circle
|
display.fillCircle(200, 150, rInstrument + 7, bgcolor); // Outer circle
|
||||||
display.fillRect(0, 30, 400, 122, bgcolor); // Delete half top circle
|
display.fillRect(0, 30, 400, 122, bgcolor); // Delete half top circle
|
||||||
|
|
||||||
for(int i=90; i<=270; i=i+10)
|
for(int i=90; i<=270; i=i+10)
|
||||||
{
|
{
|
||||||
// Scaling values
|
// Scaling values
|
||||||
float x = 200 + (rWindGraphic-30)*sin(i/180.0*pi); // x-coordinate dots
|
float x = 200 + (rInstrument-30)*sin(i/180.0*pi); // x-coordinate dots
|
||||||
float y = 150 - (rWindGraphic-30)*cos(i/180.0*pi); // y-coordinate cots
|
float y = 150 - (rInstrument-30)*cos(i/180.0*pi); // y-coordinate cots
|
||||||
const char *ii = " ";
|
const char *ii = " ";
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
|
@ -124,8 +126,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw sub scale with dots
|
// Draw sub scale with dots
|
||||||
float x1c = 200 + rWindGraphic*sin(i/180.0*pi);
|
float x1c = 200 + rInstrument*sin(i/180.0*pi);
|
||||||
float y1c = 150 - rWindGraphic*cos(i/180.0*pi);
|
float y1c = 150 - rInstrument*cos(i/180.0*pi);
|
||||||
display.fillCircle((int)x1c, (int)y1c, 2, pixelcolor);
|
display.fillCircle((int)x1c, (int)y1c, 2, pixelcolor);
|
||||||
float sinx=sin(i/180.0*pi);
|
float sinx=sin(i/180.0*pi);
|
||||||
float cosx=cos(i/180.0*pi);
|
float cosx=cos(i/180.0*pi);
|
||||||
|
@ -135,8 +137,8 @@ public:
|
||||||
float dx=2; // Line thickness = 2*dx+1
|
float dx=2; // Line thickness = 2*dx+1
|
||||||
float xx1 = -dx;
|
float xx1 = -dx;
|
||||||
float xx2 = +dx;
|
float xx2 = +dx;
|
||||||
float yy1 = -(rWindGraphic-10);
|
float yy1 = -(rInstrument-10);
|
||||||
float yy2 = -(rWindGraphic+10);
|
float yy2 = -(rInstrument+10);
|
||||||
display.fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
display.fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||||
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||||
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),pixelcolor);
|
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),pixelcolor);
|
||||||
|
@ -184,7 +186,7 @@ public:
|
||||||
float xx1 = -startwidth;
|
float xx1 = -startwidth;
|
||||||
float xx2 = startwidth;
|
float xx2 = startwidth;
|
||||||
float yy1 = -startwidth;
|
float yy1 = -startwidth;
|
||||||
float yy2 = -(rWindGraphic * 0.5);
|
float yy2 = -(rInstrument * 0.5);
|
||||||
display.fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
display.fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||||
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||||
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor);
|
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor);
|
||||||
|
@ -193,7 +195,7 @@ public:
|
||||||
float endwidth = 2; // End width of pointer
|
float endwidth = 2; // End width of pointer
|
||||||
float ix1 = endwidth;
|
float ix1 = endwidth;
|
||||||
float ix2 = -endwidth;
|
float ix2 = -endwidth;
|
||||||
float iy1 = -(rWindGraphic * 0.5);
|
float iy1 = -(rInstrument * 0.5);
|
||||||
float iy2 = -endwidth;
|
float iy2 = -endwidth;
|
||||||
display.fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
display.fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
||||||
200+(int)(cosx*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
|
200+(int)(cosx*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
|
||||||
|
@ -243,3 +245,5 @@ PageDescription registerPageRudderPosition(
|
||||||
{"RPOS"}, // Bus values we need in the page
|
{"RPOS"}, // Bus values we need in the page
|
||||||
true // Show display header on/off
|
true // Show display header on/off
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,3 +1,5 @@
|
||||||
|
#ifdef BOARD_NODEMCU32S_OBP60
|
||||||
|
|
||||||
#include "Pagedata.h"
|
#include "Pagedata.h"
|
||||||
#include "OBP60ExtensionPort.h"
|
#include "OBP60ExtensionPort.h"
|
||||||
|
|
||||||
|
@ -278,3 +280,5 @@ PageDescription registerPageThreeValues(
|
||||||
3, // Number of bus values depends on selection in Web configuration
|
3, // Number of bus values depends on selection in Web configuration
|
||||||
true // Show display header on/off
|
true // Show display header on/off
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,3 +1,5 @@
|
||||||
|
#ifdef BOARD_NODEMCU32S_OBP60
|
||||||
|
|
||||||
#include "Pagedata.h"
|
#include "Pagedata.h"
|
||||||
#include "OBP60ExtensionPort.h"
|
#include "OBP60ExtensionPort.h"
|
||||||
|
|
||||||
|
@ -218,3 +220,5 @@ PageDescription registerPageTwoValues(
|
||||||
2, // Number of bus values depends on selection in Web configuration
|
2, // Number of bus values depends on selection in Web configuration
|
||||||
true // Show display header on/off
|
true // Show display header on/off
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,3 +1,5 @@
|
||||||
|
#ifdef BOARD_NODEMCU32S_OBP60
|
||||||
|
|
||||||
#include "Pagedata.h"
|
#include "Pagedata.h"
|
||||||
#include "OBP60ExtensionPort.h"
|
#include "OBP60ExtensionPort.h"
|
||||||
|
|
||||||
|
@ -183,3 +185,5 @@ PageDescription registerPageVoltage(
|
||||||
{}, // Names of bus values undepends on selection in Web configuration (refer GwBoatData.h)
|
{}, // Names of bus values undepends on selection in Web configuration (refer GwBoatData.h)
|
||||||
true // Show display header on/off
|
true // Show display header on/off
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,3 +1,5 @@
|
||||||
|
#ifdef BOARD_NODEMCU32S_OBP60
|
||||||
|
|
||||||
#include "Pagedata.h"
|
#include "Pagedata.h"
|
||||||
#include "OBP60ExtensionPort.h"
|
#include "OBP60ExtensionPort.h"
|
||||||
|
|
||||||
|
@ -57,3 +59,5 @@ PageDescription registerPageWhite(
|
||||||
0, // Number of bus values depends on selection in Web configuration
|
0, // Number of bus values depends on selection in Web configuration
|
||||||
false // Show display header on/off
|
false // Show display header on/off
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,3 +1,5 @@
|
||||||
|
#ifdef BOARD_NODEMCU32S_OBP60
|
||||||
|
|
||||||
#include "Pagedata.h"
|
#include "Pagedata.h"
|
||||||
#include "OBP60ExtensionPort.h"
|
#include "OBP60ExtensionPort.h"
|
||||||
|
|
||||||
|
@ -241,19 +243,19 @@ public:
|
||||||
//*******************************************************************************************
|
//*******************************************************************************************
|
||||||
|
|
||||||
// Draw wind rose
|
// Draw wind rose
|
||||||
int rWindGraphic = 110; // Radius of grafic instrument
|
int rInstrument = 110; // Radius of grafic instrument
|
||||||
float pi = 3.141592;
|
float pi = 3.141592;
|
||||||
|
|
||||||
display.fillCircle(200, 150, rWindGraphic + 10, pixelcolor); // Outer circle
|
display.fillCircle(200, 150, rInstrument + 10, pixelcolor); // Outer circle
|
||||||
display.fillCircle(200, 150, rWindGraphic + 7, bgcolor); // Outer circle
|
display.fillCircle(200, 150, rInstrument + 7, bgcolor); // Outer circle
|
||||||
display.fillCircle(200, 150, rWindGraphic - 10, pixelcolor); // Inner circle
|
display.fillCircle(200, 150, rInstrument - 10, pixelcolor); // Inner circle
|
||||||
display.fillCircle(200, 150, rWindGraphic - 13, bgcolor); // Inner circle
|
display.fillCircle(200, 150, rInstrument - 13, bgcolor); // Inner circle
|
||||||
|
|
||||||
for(int i=0; i<360; i=i+10)
|
for(int i=0; i<360; i=i+10)
|
||||||
{
|
{
|
||||||
// Scaling values
|
// Scaling values
|
||||||
float x = 200 + (rWindGraphic-30)*sin(i/180.0*pi); // x-coordinate dots
|
float x = 200 + (rInstrument-30)*sin(i/180.0*pi); // x-coordinate dots
|
||||||
float y = 150 - (rWindGraphic-30)*cos(i/180.0*pi); // y-coordinate cots
|
float y = 150 - (rInstrument-30)*cos(i/180.0*pi); // y-coordinate cots
|
||||||
const char *ii = "";
|
const char *ii = "";
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
|
@ -283,8 +285,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw sub scale with dots
|
// Draw sub scale with dots
|
||||||
float x1c = 200 + rWindGraphic*sin(i/180.0*pi);
|
float x1c = 200 + rInstrument*sin(i/180.0*pi);
|
||||||
float y1c = 150 - rWindGraphic*cos(i/180.0*pi);
|
float y1c = 150 - rInstrument*cos(i/180.0*pi);
|
||||||
display.fillCircle((int)x1c, (int)y1c, 2, pixelcolor);
|
display.fillCircle((int)x1c, (int)y1c, 2, pixelcolor);
|
||||||
float sinx=sin(i/180.0*pi);
|
float sinx=sin(i/180.0*pi);
|
||||||
float cosx=cos(i/180.0*pi);
|
float cosx=cos(i/180.0*pi);
|
||||||
|
@ -294,8 +296,8 @@ public:
|
||||||
float dx=2; // Line thickness = 2*dx+1
|
float dx=2; // Line thickness = 2*dx+1
|
||||||
float xx1 = -dx;
|
float xx1 = -dx;
|
||||||
float xx2 = +dx;
|
float xx2 = +dx;
|
||||||
float yy1 = -(rWindGraphic-10);
|
float yy1 = -(rInstrument-10);
|
||||||
float yy2 = -(rWindGraphic+10);
|
float yy2 = -(rInstrument+10);
|
||||||
display.fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
display.fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||||
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||||
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),pixelcolor);
|
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),pixelcolor);
|
||||||
|
@ -315,7 +317,7 @@ public:
|
||||||
float xx1 = -startwidth;
|
float xx1 = -startwidth;
|
||||||
float xx2 = startwidth;
|
float xx2 = startwidth;
|
||||||
float yy1 = -startwidth;
|
float yy1 = -startwidth;
|
||||||
float yy2 = -(rWindGraphic-15);
|
float yy2 = -(rInstrument-15);
|
||||||
display.fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
display.fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||||
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||||
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor);
|
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor);
|
||||||
|
@ -324,7 +326,7 @@ public:
|
||||||
float endwidth = 2; // End width of pointer
|
float endwidth = 2; // End width of pointer
|
||||||
float ix1 = endwidth;
|
float ix1 = endwidth;
|
||||||
float ix2 = -endwidth;
|
float ix2 = -endwidth;
|
||||||
float iy1 = -(rWindGraphic-15);
|
float iy1 = -(rInstrument-15);
|
||||||
float iy2 = -endwidth;
|
float iy2 = -endwidth;
|
||||||
display.fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
display.fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
||||||
200+(int)(cosx*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
|
200+(int)(cosx*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
|
||||||
|
@ -374,3 +376,5 @@ PageDescription registerPageWindRose(
|
||||||
{"AWA", "AWS", "TWD", "TWS"}, // Bus values we need in the page
|
{"AWA", "AWS", "TWD", "TWS"}, // Bus values we need in the page
|
||||||
true // Show display header on/off
|
true // Show display header on/off
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#endif
|
|
@ -32,7 +32,8 @@ typedef struct{
|
||||||
double onewireTemp4 = 0;
|
double onewireTemp4 = 0;
|
||||||
double onewireTemp5 = 0;
|
double onewireTemp5 = 0;
|
||||||
double onewireTemp6 = 0;
|
double onewireTemp6 = 0;
|
||||||
int rotationAngle = 0;
|
double rotationAngle = 0; // Rotation angle in radiant
|
||||||
|
bool validRotAngle = false; // Valid flag for magnet present
|
||||||
} SensorData;
|
} SensorData;
|
||||||
|
|
||||||
typedef struct{
|
typedef struct{
|
||||||
|
|
|
@ -457,7 +457,7 @@
|
||||||
"list": [
|
"list": [
|
||||||
"Off",
|
"Off",
|
||||||
"Bus Data",
|
"Bus Data",
|
||||||
"GPS Fix",
|
"GPS Fix Lost",
|
||||||
"Limit Violation"
|
"Limit Violation"
|
||||||
],
|
],
|
||||||
"category": "OBP60 Display",
|
"category": "OBP60 Display",
|
||||||
|
@ -548,7 +548,7 @@
|
||||||
"type": "list",
|
"type": "list",
|
||||||
"default": "Voltage",
|
"default": "Voltage",
|
||||||
"description": "Type of page for page 1",
|
"description": "Type of page for page 1",
|
||||||
"list":["oneValue","twoValues","threeValues","forValues","forValues2","apparentWind","WindRose","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition"],
|
"list":["oneValue","twoValues","threeValues","forValues","forValues2","apparentWind","WindRose","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition","KeelPosition"],
|
||||||
"category": "OBP60 Page 1",
|
"category": "OBP60 Page 1",
|
||||||
"capabilities": {
|
"capabilities": {
|
||||||
"obp60":"true"
|
"obp60":"true"
|
||||||
|
@ -608,7 +608,7 @@
|
||||||
"type": "list",
|
"type": "list",
|
||||||
"default": "apparentWind",
|
"default": "apparentWind",
|
||||||
"description": "Type of page for page 2",
|
"description": "Type of page for page 2",
|
||||||
"list":["oneValue","twoValues","threeValues","forValues","forValues2","apparentWind","WindRose","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition"],
|
"list":["oneValue","twoValues","threeValues","forValues","forValues2","apparentWind","WindRose","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition","KeelPosition"],
|
||||||
"category": "OBP60 Page 2",
|
"category": "OBP60 Page 2",
|
||||||
"capabilities": {
|
"capabilities": {
|
||||||
"obp60":"true"
|
"obp60":"true"
|
||||||
|
@ -669,7 +669,7 @@
|
||||||
"type": "list",
|
"type": "list",
|
||||||
"default": "oneValue",
|
"default": "oneValue",
|
||||||
"description": "Type of page for page 3",
|
"description": "Type of page for page 3",
|
||||||
"list":["oneValue","twoValues","threeValues","forValues","forValues2","apparentWind","WindRose","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition"],
|
"list":["oneValue","twoValues","threeValues","forValues","forValues2","apparentWind","WindRose","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition","KeelPosition"],
|
||||||
"category": "OBP60 Page 3",
|
"category": "OBP60 Page 3",
|
||||||
"capabilities": {
|
"capabilities": {
|
||||||
"obp60":"true"
|
"obp60":"true"
|
||||||
|
@ -730,7 +730,7 @@
|
||||||
"type": "list",
|
"type": "list",
|
||||||
"default": "oneValue",
|
"default": "oneValue",
|
||||||
"description": "Type of page for page 4",
|
"description": "Type of page for page 4",
|
||||||
"list":["oneValue","twoValues","threeValues","forValues","forValues2","apparentWind","WindRose","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition"],
|
"list":["oneValue","twoValues","threeValues","forValues","forValues2","apparentWind","WindRose","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition","KeelPosition"],
|
||||||
"category": "OBP60 Page 4",
|
"category": "OBP60 Page 4",
|
||||||
"capabilities": {
|
"capabilities": {
|
||||||
"obp60":"true"
|
"obp60":"true"
|
||||||
|
@ -791,7 +791,7 @@
|
||||||
"type": "list",
|
"type": "list",
|
||||||
"default": "oneValue",
|
"default": "oneValue",
|
||||||
"description": "Type of page for page 5",
|
"description": "Type of page for page 5",
|
||||||
"list":["oneValue","twoValues","threeValues","forValues","forValues2","apparentWind","WindRose","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition"],
|
"list":["oneValue","twoValues","threeValues","forValues","forValues2","apparentWind","WindRose","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition","KeelPosition"],
|
||||||
"category": "OBP60 Page 5",
|
"category": "OBP60 Page 5",
|
||||||
"capabilities": {
|
"capabilities": {
|
||||||
"obp60":"true"
|
"obp60":"true"
|
||||||
|
@ -852,7 +852,7 @@
|
||||||
"type": "list",
|
"type": "list",
|
||||||
"default": "oneValue",
|
"default": "oneValue",
|
||||||
"description": "Type of page for page 6",
|
"description": "Type of page for page 6",
|
||||||
"list":["oneValue","twoValues","threeValues","forValues","forValues2","apparentWind","WindRose","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition"],
|
"list":["oneValue","twoValues","threeValues","forValues","forValues2","apparentWind","WindRose","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition","KeelPosition"],
|
||||||
"category": "OBP60 Page 6",
|
"category": "OBP60 Page 6",
|
||||||
"capabilities": {
|
"capabilities": {
|
||||||
"obp60":"true"
|
"obp60":"true"
|
||||||
|
@ -913,7 +913,7 @@
|
||||||
"type": "list",
|
"type": "list",
|
||||||
"default": "oneValue",
|
"default": "oneValue",
|
||||||
"description": "Type of page for page 7",
|
"description": "Type of page for page 7",
|
||||||
"list":["oneValue","twoValues","threeValues","forValues","forValues2","apparentWind","WindRose","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition"],
|
"list":["oneValue","twoValues","threeValues","forValues","forValues2","apparentWind","WindRose","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition","KeelPosition"],
|
||||||
"category": "OBP60 Page 7",
|
"category": "OBP60 Page 7",
|
||||||
"capabilities": {
|
"capabilities": {
|
||||||
"obp60":"true"
|
"obp60":"true"
|
||||||
|
@ -974,7 +974,7 @@
|
||||||
"type": "list",
|
"type": "list",
|
||||||
"default": "oneValue",
|
"default": "oneValue",
|
||||||
"description": "Type of page for page 8",
|
"description": "Type of page for page 8",
|
||||||
"list":["oneValue","twoValues","threeValues","forValues","forValues2","apparentWind","WindRose","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition"],
|
"list":["oneValue","twoValues","threeValues","forValues","forValues2","apparentWind","WindRose","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition","KeelPosition"],
|
||||||
"category": "OBP60 Page 8",
|
"category": "OBP60 Page 8",
|
||||||
"capabilities": {
|
"capabilities": {
|
||||||
"obp60":"true"
|
"obp60":"true"
|
||||||
|
@ -1035,7 +1035,7 @@
|
||||||
"type": "list",
|
"type": "list",
|
||||||
"default": "oneValue",
|
"default": "oneValue",
|
||||||
"description": "Type of page for page 9",
|
"description": "Type of page for page 9",
|
||||||
"list":["oneValue","twoValues","threeValues","forValues","forValues2","apparentWind","WindRose","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition"],
|
"list":["oneValue","twoValues","threeValues","forValues","forValues2","apparentWind","WindRose","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition","KeelPosition"],
|
||||||
"category": "OBP60 Page 9",
|
"category": "OBP60 Page 9",
|
||||||
"capabilities": {
|
"capabilities": {
|
||||||
"obp60":"true"
|
"obp60":"true"
|
||||||
|
@ -1096,7 +1096,7 @@
|
||||||
"type": "list",
|
"type": "list",
|
||||||
"default": "oneValue",
|
"default": "oneValue",
|
||||||
"description": "Type of page for page 10",
|
"description": "Type of page for page 10",
|
||||||
"list":["oneValue","twoValues","threeValues","forValues","forValues2","apparentWind","WindRose","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition"],
|
"list":["oneValue","twoValues","threeValues","forValues","forValues2","apparentWind","WindRose","Voltage","DST810","Clock","WhitePage","BME280","RudderPosition","KeelPosition"],
|
||||||
"category": "OBP60 Page 10",
|
"category": "OBP60 Page 10",
|
||||||
"capabilities": {
|
"capabilities": {
|
||||||
"obp60":"true"
|
"obp60":"true"
|
||||||
|
|
|
@ -252,7 +252,8 @@ void OBP60Init(GwApi *api){
|
||||||
String rotSensor=api->getConfig()->getConfigItem(api->getConfig()->useRotSensor,true)->asString();
|
String rotSensor=api->getConfig()->getConfigItem(api->getConfig()->useRotSensor,true)->asString();
|
||||||
|
|
||||||
if(String(rotSensor) == "AS5600"){
|
if(String(rotSensor) == "AS5600"){
|
||||||
if (as5600.detectMagnet() == 0) {
|
Wire.beginTransmission(AS5600_I2C_ADDR);
|
||||||
|
if (Wire.endTransmission() != 0) {
|
||||||
api->getLogger()->logDebug(GwLog::ERROR,"Modul AS5600 not found, check wiring");
|
api->getLogger()->logDebug(GwLog::ERROR,"Modul AS5600 not found, check wiring");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -394,6 +395,8 @@ void registerAllPages(PageList &list){
|
||||||
list.add(®isterPageBME280);
|
list.add(®isterPageBME280);
|
||||||
extern PageDescription registerPageRudderPosition;
|
extern PageDescription registerPageRudderPosition;
|
||||||
list.add(®isterPageRudderPosition);
|
list.add(®isterPageRudderPosition);
|
||||||
|
extern PageDescription registerPageKeelPosition;
|
||||||
|
list.add(®isterPageKeelPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
// OBP60 Task
|
// OBP60 Task
|
||||||
|
@ -525,6 +528,8 @@ void OBP60Task(GwApi *api){
|
||||||
String backlight = api->getConfig()->getConfigItem(api->getConfig()->backlight,true)->asString();
|
String backlight = api->getConfig()->getConfigItem(api->getConfig()->backlight,true)->asString();
|
||||||
String envsensor = api->getConfig()->getConfigItem(api->getConfig()->useEnvSensor,true)->asString();
|
String envsensor = api->getConfig()->getConfigItem(api->getConfig()->useEnvSensor,true)->asString();
|
||||||
String rotsensor = api->getConfig()->getConfigItem(api->getConfig()->useRotSensor,true)->asString();
|
String rotsensor = api->getConfig()->getConfigItem(api->getConfig()->useRotSensor,true)->asString();
|
||||||
|
String rotfunction = api->getConfig()->getConfigItem(api->getConfig()->rotFunction,true)->asString();
|
||||||
|
int rotoffset = api->getConfig()->getConfigItem(api->getConfig()->rotOffset,true)->asInt();
|
||||||
|
|
||||||
// refreshmode defined in init section
|
// refreshmode defined in init section
|
||||||
// displaycolor defined in init section
|
// displaycolor defined in init section
|
||||||
|
@ -576,11 +581,11 @@ void OBP60Task(GwApi *api){
|
||||||
}
|
}
|
||||||
|
|
||||||
// If GPS fix then LED off (HDOP)
|
// If GPS fix then LED off (HDOP)
|
||||||
if(String(gpsFix) == "GPS Fix" && hdop->valid == true && int(hdop->value) <= 50){
|
if(String(gpsFix) == "GPS Fix Lost" && hdop->valid == true && int(hdop->value) <= 50){
|
||||||
setPortPin(OBP_FLASH_LED, false);
|
setPortPin(OBP_FLASH_LED, false);
|
||||||
}
|
}
|
||||||
// Ifmissing GPS fix then LED on
|
// Ifmissing GPS fix then LED on
|
||||||
if(String(gpsFix) == "GPS Fix" && ((hdop->valid == true && int(hdop->value) > 50) || hdop->valid == false)){
|
if(String(gpsFix) == "GPS Fix Lost" && ((hdop->valid == true && int(hdop->value) > 50) || hdop->valid == false)){
|
||||||
setPortPin(OBP_FLASH_LED, true);
|
setPortPin(OBP_FLASH_LED, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -748,17 +753,50 @@ void OBP60Task(GwApi *api){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send rotation angle all 100ms
|
// Send rotation angle all 1000ms
|
||||||
if(millis() > starttime7 + 100){
|
if(millis() > starttime7 + 1000){
|
||||||
starttime7 = millis();
|
starttime7 = millis();
|
||||||
if(String(rotsensor) == "AS5600" && AS5600_ready == true){
|
if(String(rotsensor) == "AS5600" && AS5600_ready == true && as5600.detectMagnet() == 1){
|
||||||
rotationangle = as5600.getRawAngle() * 0.087; // 0...4095 segments = 0.087 degree
|
rotationangle = as5600.getRawAngle() * 0.087; // 0...4095 segments = 0.087 degree
|
||||||
commonData.data.rotationAngle = rotationangle; // Data take over to page
|
// Offset correction
|
||||||
// Send to NMEA200 bus
|
if(rotoffset >= 0){
|
||||||
if(!isnan(rotationangle)){
|
rotationangle = rotationangle + rotoffset;
|
||||||
SetN2kRudder(N2kMsg, rotationangle, 0, N2kRDO_NoDirectionOrder, N2kDoubleNA);
|
rotationangle = int(rotationangle) % 360;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
rotationangle = rotationangle + 360 + rotoffset;
|
||||||
|
rotationangle = int(rotationangle) % 360;
|
||||||
|
}
|
||||||
|
commonData.data.rotationAngle = DegToRad(rotationangle); // Data take over to page
|
||||||
|
commonData.data.validRotAngle = true; // Valid true, magnet present
|
||||||
|
// Send to NMEA200 bus as rudder angle values
|
||||||
|
if(!isnan(rotationangle) && String(rotfunction) == "Rudder"){
|
||||||
|
double rudder = rotationangle - 180; // Center position is 180°
|
||||||
|
// Rudder limits to +/-45°
|
||||||
|
if(rudder < -45){
|
||||||
|
rudder = -45;
|
||||||
|
}
|
||||||
|
if(rudder > 45){
|
||||||
|
rudder = 45;
|
||||||
|
}
|
||||||
|
SetN2kRudder(N2kMsg, DegToRad(rudder), 0, N2kRDO_NoDirectionOrder, PI);
|
||||||
api->sendN2kMessage(N2kMsg);
|
api->sendN2kMessage(N2kMsg);
|
||||||
}
|
}
|
||||||
|
// Send to NMEA200 bus as wind angle values
|
||||||
|
if(!isnan(rotationangle) && String(rotfunction) == "Wind"){
|
||||||
|
SetN2kWindSpeed(N2kMsg, 1, 0, DegToRad(rotationangle), N2kWind_Apprent);
|
||||||
|
api->sendN2kMessage(N2kMsg);
|
||||||
|
}
|
||||||
|
// Send to NMEA200 bus as trim angle values in [%]
|
||||||
|
if(!isnan(rotationangle) && (String(rotfunction) == "Mast" || String(rotfunction) == "Keel" || String(rotfunction) == "Trim" || String(rotfunction) == "Boom")){
|
||||||
|
int trim = rotationangle * 100 / 360; // 0...360° -> 0...100%
|
||||||
|
SetN2kTrimTab(N2kMsg, trim, trim);
|
||||||
|
api->sendN2kMessage(N2kMsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
commonData.data.rotationAngle = 0; // Center position 0°
|
||||||
|
commonData.data.validRotAngle = false; // Valid false, magnet missing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue