mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2025-12-28 05:03:06 +01:00
Compare commits
5 Commits
f46a43d7fd
...
keypad
| Author | SHA1 | Date | |
|---|---|---|---|
| 898922769a | |||
|
|
470c0e5f4d | ||
|
|
9a792b49db | ||
| 8f851a4b61 | |||
|
|
e5950f95fd |
@@ -137,6 +137,7 @@ class GwApi{
|
||||
* thread safe methods - can directly be called from a user task
|
||||
*/
|
||||
virtual GwRequestQueue *getQueue()=0;
|
||||
virtual QueueHandle_t getKbQueue()=0;
|
||||
virtual void sendN2kMessage(const tN2kMsg &msg, bool convert=true)=0;
|
||||
/**
|
||||
* deprecated - sourceId will be ignored
|
||||
|
||||
@@ -71,6 +71,7 @@ class GwConverterConfig{
|
||||
int rmcInterval=1000;
|
||||
int rmcCheckTime=4000;
|
||||
int winst312=256;
|
||||
int swBankInstance=0;
|
||||
bool unmappedXdr=false;
|
||||
unsigned long xdrTimeout=60000;
|
||||
std::vector<WindMapping> windMappings;
|
||||
@@ -97,6 +98,7 @@ class GwConverterConfig{
|
||||
windMappings.push_back(mapping);
|
||||
}
|
||||
}
|
||||
swBankInstance=config->getInt(GwConfigDefinitions::swBankInstance,0);
|
||||
}
|
||||
const WindMapping findWindMapping(const tN2kWindReference &n2k) const{
|
||||
for (const auto & it:windMappings){
|
||||
@@ -113,4 +115,4 @@ class GwConverterConfig{
|
||||
|
||||
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1572,6 +1572,36 @@ private:
|
||||
finalizeXdr();
|
||||
}
|
||||
|
||||
void Handle127502(const tN2kMsg &msg){
|
||||
// switch bank control / receive remote key strokes
|
||||
unsigned char instance=-1;
|
||||
tN2kBinaryStatus bankstatus;
|
||||
LOG_DEBUG(GwLog::LOG,"received switch bank control");
|
||||
// check if we are addressed and our configured instance is used
|
||||
if (! ParseN2kPGN127502(msg,instance,bankstatus)) {
|
||||
LOG_DEBUG(GwLog::DEBUG,"unable to parse PGN %d",msg.PGN);
|
||||
return;
|
||||
}
|
||||
if (! (instance == config.swBankInstance)) {
|
||||
LOG_DEBUG(GwLog::DEBUG,"switch bank instance #%d ignored",instance);
|
||||
return;
|
||||
}
|
||||
// TODO (?) multiple keys together
|
||||
|
||||
// only process configured key count (default 6)
|
||||
for (uint8_t i=1; i<=6; i++) {
|
||||
tN2kOnOff keystatus = N2kGetStatusOnBinaryStatus(bankstatus, i);
|
||||
if (keystatus == 1) {
|
||||
// key pressed: send key to queue
|
||||
xQueueSend(keyboardQueue, &i, 0);
|
||||
} else if (keystatus == 2) {
|
||||
// long key pressed: send long key to queue
|
||||
xQueueSend(keyboardQueue, &i, 0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void registerConverters()
|
||||
{
|
||||
//register all converter functions
|
||||
@@ -1607,6 +1637,7 @@ private:
|
||||
converters.registerConverter(127488UL, &N2kToNMEA0183Functions::Handle127488);
|
||||
converters.registerConverter(130316UL, &N2kToNMEA0183Functions::Handle130316);
|
||||
converters.registerConverter(127257UL, &N2kToNMEA0183Functions::Handle127257);
|
||||
converters.registerConverter(127502UL, &N2kToNMEA0183Functions::Handle127502);
|
||||
#define HANDLE_AIS
|
||||
#ifdef HANDLE_AIS
|
||||
converters.registerConverter(129038UL, &N2kToNMEA0183Functions::HandleAISClassAPosReport); // AIS Class A Position Report, Message Type 1
|
||||
@@ -1620,13 +1651,15 @@ private:
|
||||
public:
|
||||
N2kToNMEA0183Functions(GwLog *logger, GwBoatData *boatData,
|
||||
SendNMEA0183MessageCallback callback,
|
||||
String talkerId, GwXDRMappings *xdrMappings, const GwConverterConfig &cfg)
|
||||
String talkerId, GwXDRMappings *xdrMappings, const GwConverterConfig &cfg,
|
||||
QueueHandle_t kbQueue)
|
||||
: N2kDataToNMEA0183(logger, boatData, callback,talkerId)
|
||||
{
|
||||
this->logger = logger;
|
||||
this->boatData = boatData;
|
||||
this->xdrMappings=xdrMappings;
|
||||
this->config=cfg;
|
||||
this->keyboardQueue=kbQueue;
|
||||
registerConverters();
|
||||
}
|
||||
virtual void loop(unsigned long lastExtRmc) override
|
||||
@@ -1642,8 +1675,8 @@ private:
|
||||
|
||||
N2kDataToNMEA0183* N2kDataToNMEA0183::create(GwLog *logger, GwBoatData *boatData,
|
||||
SendNMEA0183MessageCallback callback, String talkerId, GwXDRMappings *xdrMappings,
|
||||
const GwConverterConfig &cfg){
|
||||
LOG_DEBUG(GwLog::LOG,"creating N2kToNMEA0183");
|
||||
return new N2kToNMEA0183Functions(logger,boatData,callback, talkerId,xdrMappings,cfg);
|
||||
const GwConverterConfig &cfg, QueueHandle_t kbQueue){
|
||||
LOG_DEBUG(GwLog::LOG,"creating N2kToNMEA0183");
|
||||
return new N2kToNMEA0183Functions(logger,boatData,callback, talkerId,xdrMappings,cfg,kbQueue);
|
||||
}
|
||||
//*****************************************************************************
|
||||
|
||||
@@ -43,6 +43,7 @@ protected:
|
||||
GwBoatData *boatData;
|
||||
int sourceId=0;
|
||||
char talkerId[3];
|
||||
QueueHandle_t keyboardQueue;
|
||||
SendNMEA0183MessageCallback sendNMEA0183MessageCallback;
|
||||
void SendMessage(const tNMEA0183Msg &NMEA0183Msg);
|
||||
N2kDataToNMEA0183(GwLog *logger, GwBoatData *boatData,
|
||||
@@ -50,7 +51,8 @@ protected:
|
||||
|
||||
public:
|
||||
static N2kDataToNMEA0183* create(GwLog *logger, GwBoatData *boatData, SendNMEA0183MessageCallback callback,
|
||||
String talkerId, GwXDRMappings *xdrMappings,const GwConverterConfig &cfg);
|
||||
String talkerId, GwXDRMappings *xdrMappings,const GwConverterConfig &cfg,
|
||||
QueueHandle_t kbQueue);
|
||||
virtual void HandleMsg(const tN2kMsg &N2kMsg, int sourceId) = 0;
|
||||
virtual void loop(unsigned long lastRmc);
|
||||
virtual ~N2kDataToNMEA0183(){}
|
||||
@@ -59,4 +61,4 @@ public:
|
||||
virtual void toJson(GwJsonDocument *json)=0;
|
||||
virtual String handledKeys()=0;
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "fonts/Ubuntu_Bold20pt8b.h"
|
||||
#include "fonts/Ubuntu_Bold32pt8b.h"
|
||||
#include "fonts/Atari16px8b.h" // Key label font
|
||||
#include "fonts/IBM8x8px.h"
|
||||
|
||||
// E-Ink Display
|
||||
#define GxEPD_WIDTH 400 // Display width
|
||||
|
||||
@@ -51,6 +51,7 @@ extern const GFXfont Ubuntu_Bold16pt8b;
|
||||
extern const GFXfont Ubuntu_Bold20pt8b;
|
||||
extern const GFXfont Ubuntu_Bold32pt8b;
|
||||
extern const GFXfont Atari16px;
|
||||
extern const GFXfont IBM8x8px;
|
||||
|
||||
// Global functions
|
||||
#ifdef DISPLAY_GDEW042T2
|
||||
|
||||
@@ -121,18 +121,20 @@ public:
|
||||
getdisplay().setCursor(c.x - r + 3 , c.y + h / 2);
|
||||
getdisplay().print("W");
|
||||
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt8b);
|
||||
|
||||
// show satellites in "map"
|
||||
getdisplay().setFont(&IBM8x8px);
|
||||
for (int i = 0; i < nSat; i++) {
|
||||
float arad = (sats[i].Azimut * M_PI / 180.0) + M_PI;
|
||||
float erad = sats[i].Elevation * M_PI / 180.0;
|
||||
uint16_t x = c.x + sin(arad) * erad * r1;
|
||||
uint16_t y = c.y + cos(arad) * erad * r1;
|
||||
getdisplay().fillRect(x-4, y-4, 8, 8, commonData->fgcolor);
|
||||
getdisplay().setCursor(x-7, y+12);
|
||||
getdisplay().printf("%02d", static_cast<int>(sats[i].PRN));
|
||||
}
|
||||
|
||||
// Signal / Noise bars
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt8b);
|
||||
getdisplay().setCursor(325, 34);
|
||||
getdisplay().print("SNR");
|
||||
// getdisplay().drawRect(270, 20, 125, 257, commonData->fgcolor);
|
||||
|
||||
@@ -247,8 +247,8 @@ public:
|
||||
if(key == 1){ // Mode switch
|
||||
if(mode == 'N'){
|
||||
mode = 'L';
|
||||
} else if (mode == 'L') {
|
||||
mode = 'X';
|
||||
// } else if (mode == 'L') {
|
||||
// mode = 'X';
|
||||
} else {
|
||||
mode = 'N';
|
||||
}
|
||||
|
||||
202
lib/obp60task/fonts/IBM8x8px.h
Normal file
202
lib/obp60task/fonts/IBM8x8px.h
Normal file
@@ -0,0 +1,202 @@
|
||||
const uint8_t IBM8x8pxBitmaps[] PROGMEM = {
|
||||
0x00, /* 0x20 space */
|
||||
0x6F, 0xF6, 0x60, 0x60, /* 0x21 exclam */
|
||||
0xDE, 0xF6, /* 0x22 quotedbl */
|
||||
0x6C, 0xDB, 0xFB, 0x6F, 0xED, 0x9B, 0x00, /* 0x23 numbersign */
|
||||
0x31, 0xFC, 0x1E, 0x0F, 0xE3, 0x00, /* 0x24 dollar */
|
||||
0xC7, 0x98, 0x61, 0x86, 0x78, 0xC0, /* 0x25 percent */
|
||||
0x38, 0xD8, 0xE3, 0xBD, 0xD9, 0x9D, 0x80, /* 0x26 ampersand */
|
||||
0x6F, 0x00, /* 0x27 quotesingle */
|
||||
0x36, 0xCC, 0xC6, 0x30, /* 0x28 parenleft */
|
||||
0xC6, 0x33, 0x36, 0xC0, /* 0x29 parenright */
|
||||
0x66, 0x3C, 0xFF, 0x3C, 0x66, /* 0x2A asterisk */
|
||||
0x30, 0xCF, 0xCC, 0x30, /* 0x2B plus */
|
||||
0x6F, 0x00, /* 0x2C comma */
|
||||
0xFC, /* 0x2D hyphen */
|
||||
0xF0, /* 0x2E period */
|
||||
0x06, 0x18, 0x61, 0x86, 0x18, 0x20, 0x00, /* 0x2F slash */
|
||||
0x7D, 0x8F, 0x3E, 0xFF, 0x7C, 0xDF, 0x00, /* 0x30 zero */
|
||||
0x31, 0xC3, 0x0C, 0x30, 0xCF, 0xC0, /* 0x31 one */
|
||||
0x7B, 0x30, 0xCE, 0x63, 0x1F, 0xC0, /* 0x32 two */
|
||||
0x7B, 0x30, 0xCE, 0x0F, 0x37, 0x80, /* 0x33 three */
|
||||
0x1C, 0x79, 0xB6, 0x6F, 0xE1, 0x87, 0x80, /* 0x34 four */
|
||||
0xFF, 0x0F, 0x83, 0x0F, 0x37, 0x80, /* 0x35 five */
|
||||
0x39, 0x8C, 0x3E, 0xCF, 0x37, 0x80, /* 0x36 six */
|
||||
0xFF, 0x30, 0xC6, 0x30, 0xC3, 0x00, /* 0x37 seven */
|
||||
0x7B, 0x3C, 0xDE, 0xCF, 0x37, 0x80, /* 0x38 eight */
|
||||
0x7B, 0x3C, 0xDF, 0x0C, 0x67, 0x00, /* 0x39 nine */
|
||||
0xF0, 0xF0, /* 0x3A colon */
|
||||
0x6C, 0x37, 0x80, /* 0x3B semicolon */
|
||||
0x19, 0x99, 0x86, 0x18, 0x60, /* 0x3C less */
|
||||
0xFC, 0x00, 0x3F, /* 0x3D equal */
|
||||
0xC3, 0x0C, 0x33, 0x33, 0x00, /* 0x3E greater */
|
||||
0x7B, 0x30, 0xC6, 0x30, 0x03, 0x00, /* 0x3F question */
|
||||
0x7D, 0x8F, 0x7E, 0xFD, 0xF8, 0x1E, 0x00, /* 0x40 at */
|
||||
0x31, 0xEC, 0xF3, 0xFF, 0x3C, 0xC0, /* 0x41 A */
|
||||
0xFC, 0xCD, 0x9B, 0xE6, 0x6C, 0xFF, 0x00, /* 0x42 B */
|
||||
0x3C, 0xCF, 0x06, 0x0C, 0x0C, 0xCF, 0x00, /* 0x43 C */
|
||||
0xF8, 0xD9, 0x9B, 0x36, 0x6D, 0xBE, 0x00, /* 0x44 D */
|
||||
0xFE, 0xC5, 0xA3, 0xC6, 0x8C, 0x7F, 0x80, /* 0x45 E */
|
||||
0xFE, 0xC5, 0xA3, 0xC6, 0x8C, 0x3C, 0x00, /* 0x46 F */
|
||||
0x3C, 0xCF, 0x06, 0x0C, 0xEC, 0xCF, 0x80, /* 0x47 G */
|
||||
0xCF, 0x3C, 0xFF, 0xCF, 0x3C, 0xC0, /* 0x48 H */
|
||||
0xF6, 0x66, 0x66, 0xF0, /* 0x49 I */
|
||||
0x1E, 0x18, 0x30, 0x6C, 0xD9, 0x9E, 0x00, /* 0x4A J */
|
||||
0xE6, 0xCD, 0xB3, 0xC6, 0xCC, 0xF9, 0x80, /* 0x4B K */
|
||||
0xF0, 0xC1, 0x83, 0x06, 0x2C, 0xFF, 0x80, /* 0x4C L */
|
||||
0xC7, 0xDF, 0xFF, 0xFD, 0x78, 0xF1, 0x80, /* 0x4D M */
|
||||
0xC7, 0xCF, 0xDE, 0xFC, 0xF8, 0xF1, 0x80, /* 0x4E N */
|
||||
0x38, 0xDB, 0x1E, 0x3C, 0x6D, 0x8E, 0x00, /* 0x4F O */
|
||||
0xFC, 0xCD, 0x9B, 0xE6, 0x0C, 0x3C, 0x00, /* 0x50 P */
|
||||
0x7B, 0x3C, 0xF3, 0xDD, 0xE1, 0xC0, /* 0x51 Q */
|
||||
0xFC, 0xCD, 0x9B, 0xE6, 0xCC, 0xF9, 0x80, /* 0x52 R */
|
||||
0x7B, 0x3E, 0x1C, 0x1F, 0x37, 0x80, /* 0x53 S */
|
||||
0xFE, 0xD3, 0x0C, 0x30, 0xC7, 0x80, /* 0x54 T */
|
||||
0xCF, 0x3C, 0xF3, 0xCF, 0x3F, 0xC0, /* 0x55 U */
|
||||
0xCF, 0x3C, 0xF3, 0xCD, 0xE3, 0x00, /* 0x56 V */
|
||||
0xC7, 0x8F, 0x1E, 0xBF, 0xFD, 0xF1, 0x80, /* 0x57 W */
|
||||
0xC7, 0x8D, 0xB1, 0xC3, 0x8D, 0xB1, 0x80, /* 0x58 X */
|
||||
0xCF, 0x3C, 0xDE, 0x30, 0xC7, 0x80, /* 0x59 Y */
|
||||
0xFF, 0x8E, 0x30, 0xC3, 0x2C, 0xFF, 0x80, /* 0x5A Z */
|
||||
0xFC, 0xCC, 0xCC, 0xF0, /* 0x5B bracketleft */
|
||||
0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0x80, /* 0x5C backslash */
|
||||
0xF3, 0x33, 0x33, 0xF0, /* 0x5D bracketright */
|
||||
0x10, 0x71, 0xB6, 0x30, /* 0x5E asciicircum */
|
||||
0xFF, /* 0x5F underscore */
|
||||
0xD9, 0x80, /* 0x60 grave */
|
||||
0x78, 0x19, 0xF6, 0x67, 0x60, /* 0x61 a */
|
||||
0xE0, 0xC1, 0x83, 0xE6, 0x6C, 0xF7, 0x00, /* 0x62 b */
|
||||
0x7B, 0x3C, 0x33, 0x78, /* 0x63 c */
|
||||
0x1C, 0x18, 0x33, 0xEC, 0xD9, 0x9D, 0x80, /* 0x64 d */
|
||||
0x7B, 0x3F, 0xF0, 0x78, /* 0x65 e */
|
||||
0x39, 0xB6, 0x3C, 0x61, 0x8F, 0x00, /* 0x66 f */
|
||||
0x77, 0x9B, 0x33, 0xE0, 0xDF, 0x00, /* 0x67 g */
|
||||
0xE0, 0xC1, 0xB3, 0xB6, 0x6C, 0xF9, 0x80, /* 0x68 h */
|
||||
0x60, 0xE6, 0x66, 0xF0, /* 0x69 i */
|
||||
0x0C, 0x00, 0xC3, 0x0F, 0x3C, 0xDE, /* 0x6A j */
|
||||
0xE0, 0xC1, 0x9B, 0x67, 0x8D, 0xB9, 0x80, /* 0x6B k */
|
||||
0xE6, 0x66, 0x66, 0xF0, /* 0x6C l */
|
||||
0xCD, 0xFF, 0xFE, 0xBC, 0x60, /* 0x6D m */
|
||||
0xFB, 0x3C, 0xF3, 0xCC, /* 0x6E n */
|
||||
0x7B, 0x3C, 0xF3, 0x78, /* 0x6F o */
|
||||
0xDC, 0xCD, 0x9B, 0xE6, 0x1E, 0x00, /* 0x70 p */
|
||||
0x77, 0x9B, 0x33, 0xE0, 0xC3, 0xC0, /* 0x71 q */
|
||||
0xDC, 0xED, 0x9B, 0x0F, 0x00, /* 0x72 r */
|
||||
0x7F, 0x07, 0x83, 0xF8, /* 0x73 s */
|
||||
0x23, 0x3E, 0xC6, 0x34, 0xC0, /* 0x74 t */
|
||||
0xCD, 0x9B, 0x36, 0x67, 0x60, /* 0x75 u */
|
||||
0xCF, 0x3C, 0xDE, 0x30, /* 0x76 v */
|
||||
0xC7, 0xAF, 0xFF, 0xF6, 0xC0, /* 0x77 w */
|
||||
0xC6, 0xD8, 0xE3, 0x6C, 0x60, /* 0x78 x */
|
||||
0xCF, 0x3C, 0xDF, 0x0F, 0xE0, /* 0x79 y */
|
||||
0xFE, 0x63, 0x19, 0xFC, /* 0x7A z */
|
||||
0x1C, 0xC3, 0x38, 0x30, 0xC1, 0xC0, /* 0x7B braceleft */
|
||||
0xFC, 0xFC, /* 0x7C bar */
|
||||
0xE0, 0xC3, 0x07, 0x30, 0xCE, 0x00, /* 0x7D braceright */
|
||||
0x77, 0xB8, /* 0x7E asciitilde */
|
||||
0x10, 0x71, 0xB6, 0x3C, 0x7F, 0xC0 /* 0x7F uni007F */
|
||||
};
|
||||
|
||||
const GFXglyph IBM8x8pxGlyphs[] PROGMEM = {
|
||||
{ 0, 1, 1, 2, 0, -1 }, /* 0x20 space */
|
||||
{ 1, 4, 7, 5, 0, -7 }, /* 0x21 exclam */
|
||||
{ 5, 5, 3, 6, 0, -7 }, /* 0x22 quotedbl */
|
||||
{ 7, 7, 7, 8, 0, -7 }, /* 0x23 numbersign */
|
||||
{ 14, 6, 7, 7, 0, -7 }, /* 0x24 dollar */
|
||||
{ 20, 7, 6, 8, 0, -6 }, /* 0x25 percent */
|
||||
{ 26, 7, 7, 8, 0, -7 }, /* 0x26 ampersand */
|
||||
{ 33, 3, 3, 4, 0, -7 }, /* 0x27 quotesingle */
|
||||
{ 35, 4, 7, 5, 0, -7 }, /* 0x28 parenleft */
|
||||
{ 39, 4, 7, 5, 0, -7 }, /* 0x29 parenright */
|
||||
{ 43, 8, 5, 9, 0, -6 }, /* 0x2A asterisk */
|
||||
{ 48, 6, 5, 7, 0, -6 }, /* 0x2B plus */
|
||||
{ 52, 3, 3, 4, 0, -2 }, /* 0x2C comma */
|
||||
{ 54, 6, 1, 7, 0, -4 }, /* 0x2D hyphen */
|
||||
{ 55, 2, 2, 3, 0, -2 }, /* 0x2E period */
|
||||
{ 56, 7, 7, 8, 0, -7 }, /* 0x2F slash */
|
||||
{ 63, 7, 7, 8, 0, -7 }, /* 0x30 zero */
|
||||
{ 70, 6, 7, 7, 0, -7 }, /* 0x31 one */
|
||||
{ 76, 6, 7, 7, 0, -7 }, /* 0x32 two */
|
||||
{ 82, 6, 7, 7, 0, -7 }, /* 0x33 three */
|
||||
{ 88, 7, 7, 8, 0, -7 }, /* 0x34 four */
|
||||
{ 95, 6, 7, 7, 0, -7 }, /* 0x35 five */
|
||||
{ 101, 6, 7, 7, 0, -7 }, /* 0x36 six */
|
||||
{ 107, 6, 7, 7, 0, -7 }, /* 0x37 seven */
|
||||
{ 113, 6, 7, 7, 0, -7 }, /* 0x38 eight */
|
||||
{ 119, 6, 7, 7, 0, -7 }, /* 0x39 nine */
|
||||
{ 125, 2, 6, 3, 0, -6 }, /* 0x3A colon */
|
||||
{ 127, 3, 6, 4, 0, -6 }, /* 0x3B semicolon */
|
||||
{ 130, 5, 7, 6, 0, -7 }, /* 0x3C less */
|
||||
{ 135, 6, 4, 7, 0, -5 }, /* 0x3D equal */
|
||||
{ 138, 5, 7, 6, 0, -7 }, /* 0x3E greater */
|
||||
{ 143, 6, 7, 7, 0, -7 }, /* 0x3F question */
|
||||
{ 149, 7, 7, 8, 0, -7 }, /* 0x40 at */
|
||||
{ 156, 6, 7, 7, 0, -7 }, /* 0x41 A */
|
||||
{ 162, 7, 7, 8, 0, -7 }, /* 0x42 B */
|
||||
{ 169, 7, 7, 8, 0, -7 }, /* 0x43 C */
|
||||
{ 176, 7, 7, 8, 0, -7 }, /* 0x44 D */
|
||||
{ 183, 7, 7, 8, 0, -7 }, /* 0x45 E */
|
||||
{ 190, 7, 7, 8, 0, -7 }, /* 0x46 F */
|
||||
{ 197, 7, 7, 8, 0, -7 }, /* 0x47 G */
|
||||
{ 204, 6, 7, 7, 0, -7 }, /* 0x48 H */
|
||||
{ 210, 4, 7, 5, 0, -7 }, /* 0x49 I */
|
||||
{ 214, 7, 7, 8, 0, -7 }, /* 0x4A J */
|
||||
{ 221, 7, 7, 8, 0, -7 }, /* 0x4B K */
|
||||
{ 228, 7, 7, 8, 0, -7 }, /* 0x4C L */
|
||||
{ 235, 7, 7, 8, 0, -7 }, /* 0x4D M */
|
||||
{ 242, 7, 7, 8, 0, -7 }, /* 0x4E N */
|
||||
{ 249, 7, 7, 8, 0, -7 }, /* 0x4F O */
|
||||
{ 256, 7, 7, 8, 0, -7 }, /* 0x50 P */
|
||||
{ 263, 6, 7, 7, 0, -7 }, /* 0x51 Q */
|
||||
{ 269, 7, 7, 8, 0, -7 }, /* 0x52 R */
|
||||
{ 276, 6, 7, 7, 0, -7 }, /* 0x53 S */
|
||||
{ 282, 6, 7, 7, 0, -7 }, /* 0x54 T */
|
||||
{ 288, 6, 7, 7, 0, -7 }, /* 0x55 U */
|
||||
{ 294, 6, 7, 7, 0, -7 }, /* 0x56 V */
|
||||
{ 300, 7, 7, 8, 0, -7 }, /* 0x57 W */
|
||||
{ 307, 7, 7, 8, 0, -7 }, /* 0x58 X */
|
||||
{ 314, 6, 7, 7, 0, -7 }, /* 0x59 Y */
|
||||
{ 320, 7, 7, 8, 0, -7 }, /* 0x5A Z */
|
||||
{ 327, 4, 7, 5, 0, -7 }, /* 0x5B bracketleft */
|
||||
{ 331, 7, 7, 8, 0, -7 }, /* 0x5C backslash */
|
||||
{ 338, 4, 7, 5, 0, -7 }, /* 0x5D bracketright */
|
||||
{ 342, 7, 4, 8, 0, -7 }, /* 0x5E asciicircum */
|
||||
{ 346, 8, 1, 9, 0, 0 }, /* 0x5F underscore */
|
||||
{ 347, 3, 3, 4, 0, -7 }, /* 0x60 grave */
|
||||
{ 349, 7, 5, 8, 0, -5 }, /* 0x61 a */
|
||||
{ 354, 7, 7, 8, 0, -7 }, /* 0x62 b */
|
||||
{ 361, 6, 5, 7, 0, -5 }, /* 0x63 c */
|
||||
{ 365, 7, 7, 8, 0, -7 }, /* 0x64 d */
|
||||
{ 372, 6, 5, 7, 0, -5 }, /* 0x65 e */
|
||||
{ 376, 6, 7, 7, 0, -7 }, /* 0x66 f */
|
||||
{ 382, 7, 6, 8, 0, -5 }, /* 0x67 g */
|
||||
{ 388, 7, 7, 8, 0, -7 }, /* 0x68 h */
|
||||
{ 395, 4, 7, 5, 0, -7 }, /* 0x69 i */
|
||||
{ 399, 6, 8, 7, 0, -7 }, /* 0x6A j */
|
||||
{ 405, 7, 7, 8, 0, -7 }, /* 0x6B k */
|
||||
{ 412, 4, 7, 5, 0, -7 }, /* 0x6C l */
|
||||
{ 416, 7, 5, 8, 0, -5 }, /* 0x6D m */
|
||||
{ 421, 6, 5, 7, 0, -5 }, /* 0x6E n */
|
||||
{ 425, 6, 5, 7, 0, -5 }, /* 0x6F o */
|
||||
{ 429, 7, 6, 8, 0, -5 }, /* 0x70 p */
|
||||
{ 435, 7, 6, 8, 0, -5 }, /* 0x71 q */
|
||||
{ 441, 7, 5, 8, 0, -5 }, /* 0x72 r */
|
||||
{ 446, 6, 5, 7, 0, -5 }, /* 0x73 s */
|
||||
{ 450, 5, 7, 6, 0, -7 }, /* 0x74 t */
|
||||
{ 455, 7, 5, 8, 0, -5 }, /* 0x75 u */
|
||||
{ 460, 6, 5, 7, 0, -5 }, /* 0x76 v */
|
||||
{ 464, 7, 5, 8, 0, -5 }, /* 0x77 w */
|
||||
{ 469, 7, 5, 8, 0, -5 }, /* 0x78 x */
|
||||
{ 474, 6, 6, 7, 0, -5 }, /* 0x79 y */
|
||||
{ 479, 6, 5, 7, 0, -5 }, /* 0x7A z */
|
||||
{ 483, 6, 7, 7, 0, -7 }, /* 0x7B braceleft */
|
||||
{ 489, 2, 7, 3, 0, -7 }, /* 0x7C bar */
|
||||
{ 491, 6, 7, 7, 0, -7 }, /* 0x7D braceright */
|
||||
{ 497, 7, 2, 8, 0, -7 }, /* 0x7E asciitilde */
|
||||
{ 499, 7, 6, 8, 0, -6 } /* 0x7F uni007F */
|
||||
};
|
||||
|
||||
const GFXfont IBM8x8px PROGMEM = {
|
||||
(uint8_t *)IBM8x8pxBitmaps,
|
||||
(GFXglyph *)IBM8x8pxGlyphs,
|
||||
0x20, 0x7F, 8 };
|
||||
@@ -85,7 +85,7 @@ void OBP60Init(GwApi *api){
|
||||
// Get CPU speed
|
||||
int freq = getCpuFrequencyMhz();
|
||||
logger->logDebug(GwLog::LOG,"CPU speed at boot: %i MHz", freq);
|
||||
|
||||
|
||||
// Settings for backlight
|
||||
String backlightMode = api->getConfig()->getConfigItem(api->getConfig()->backlight,true)->asString();
|
||||
logger->logDebug(GwLog::DEBUG,"Backlight Mode is: %s", backlightMode.c_str());
|
||||
@@ -223,7 +223,7 @@ void registerAllPages(PageList &list){
|
||||
extern PageDescription registerPageWind;
|
||||
list.add(®isterPageWind);
|
||||
extern PageDescription registerPageWindPlot;
|
||||
list.add(®isterPageWindPlot);
|
||||
list.add(®isterPageWindPlot);
|
||||
extern PageDescription registerPageWindRose;
|
||||
list.add(®isterPageWindRose);
|
||||
extern PageDescription registerPageWindRoseFlex;
|
||||
@@ -344,6 +344,8 @@ void OBP60Task(GwApi *api){
|
||||
|
||||
tN2kMsg N2kMsg;
|
||||
|
||||
QueueHandle_t keyboardQueue = api->getKbQueue();
|
||||
|
||||
LOG_DEBUG(GwLog::LOG,"obp60task started");
|
||||
for (auto it=allPages.pages.begin();it != allPages.pages.end();it++){
|
||||
LOG_DEBUG(GwLog::LOG,"found registered page %s",(*it)->pageName.c_str());
|
||||
@@ -402,7 +404,7 @@ void OBP60Task(GwApi *api){
|
||||
getdisplay().nextPage(); // Fast Refresh
|
||||
getdisplay().nextPage(); // Fast Refresh
|
||||
}
|
||||
|
||||
|
||||
// Init pages
|
||||
int numPages=1;
|
||||
PageStruct pages[MAX_PAGE_NUMBER];
|
||||
@@ -473,7 +475,7 @@ void OBP60Task(GwApi *api){
|
||||
for (auto it=description->fixedParam.begin();it != description->fixedParam.end();it++){
|
||||
GwApi::BoatValue *value=boatValues.findValueOrCreate(*it);
|
||||
LOG_DEBUG(GwLog::DEBUG,"added fixed value %s to page %d",value->getName().c_str(),i);
|
||||
pages[i].parameters.values.push_back(value);
|
||||
pages[i].parameters.values.push_back(value);
|
||||
}
|
||||
// Add boat history data to page parameters
|
||||
pages[i].parameters.boatHstry = &hstryBufList;
|
||||
@@ -549,11 +551,11 @@ void OBP60Task(GwApi *api){
|
||||
GwApi::BoatValue *hdop = boatValues.findValueOrCreate("HDOP"); // Load GpsHDOP
|
||||
|
||||
LOG_DEBUG(GwLog::LOG,"obp60task: start mainloop");
|
||||
|
||||
|
||||
commonData.time = boatValues.findValueOrCreate("GPST"); // Load GpsTime
|
||||
commonData.date = boatValues.findValueOrCreate("GPSD"); // Load GpsTime
|
||||
bool delayedDisplayUpdate = false; // If select a new pages then make a delayed full display update
|
||||
bool cpuspeedsetted = false; // Marker for change CPU speed
|
||||
bool cpuspeedsetted = false; // Marker for change CPU speed
|
||||
long firststart = millis(); // First start
|
||||
long starttime0 = millis(); // Mainloop
|
||||
long starttime1 = millis(); // Full display refresh for the first 5 min (more often as normal)
|
||||
@@ -582,7 +584,7 @@ void OBP60Task(GwApi *api){
|
||||
}
|
||||
}
|
||||
|
||||
// Set CPU speed after boot after 1min
|
||||
// Set CPU speed after boot after 1min
|
||||
if(millis() > firststart + (1 * 60 * 1000) && cpuspeedsetted == false){
|
||||
if(String(cpuspeed) == "80"){
|
||||
setCpuFrequencyMhz(80);
|
||||
@@ -603,7 +605,7 @@ void OBP60Task(GwApi *api){
|
||||
commonData.data=shared->getSensorData();
|
||||
commonData.data.actpage = pageNumber + 1;
|
||||
commonData.data.maxpage = numPages;
|
||||
|
||||
|
||||
// If GPS fix then LED off (HDOP)
|
||||
if(String(gpsFix) == "GPS Fix Lost" && hdop->value <= hdopAccuracy && hdop->valid == true){
|
||||
setFlashLED(false);
|
||||
@@ -612,9 +614,18 @@ void OBP60Task(GwApi *api){
|
||||
if((String(gpsFix) == "GPS Fix Lost" && hdop->value > hdopAccuracy && hdop->valid == true) || (String(gpsFix) == "GPS Fix Lost" && hdop->valid == false)){
|
||||
setFlashLED(true);
|
||||
}
|
||||
|
||||
|
||||
// Keyboard messages from remote
|
||||
uint8_t remotekey = 0;
|
||||
if (xQueueReceive(keyboardQueue, &remotekey, 0) == pdPASS) {
|
||||
LOG_DEBUG(GwLog::LOG, "OBP received remote key: %d", remotekey);
|
||||
// inject into internal keyboard queue
|
||||
xQueueSend(allParameters.queue, &remotekey, 0);
|
||||
}
|
||||
|
||||
// Check the keyboard message
|
||||
int keyboardMessage=0;
|
||||
|
||||
while (xQueueReceive(allParameters.queue,&keyboardMessage,0)){
|
||||
LOG_DEBUG(GwLog::LOG,"new key from keyboard %d",keyboardMessage);
|
||||
keypressed = true;
|
||||
@@ -677,13 +688,13 @@ void OBP60Task(GwApi *api){
|
||||
commonData.data.actpage = pageNumber + 1;
|
||||
commonData.data.maxpage = numPages;
|
||||
}
|
||||
|
||||
|
||||
// #9 or #10 Refresh display after a new page after 4s waiting time and if refresh is disabled
|
||||
if(refreshmode == true && (keyboardMessage == 9 || keyboardMessage == 10 || keyboardMessage == 4 || keyboardMessage == 3)){
|
||||
starttime4 = millis();
|
||||
starttime2 = millis(); // Reset the timer for full display update
|
||||
delayedDisplayUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
LOG_DEBUG(GwLog::LOG,"set pagenumber to %d",pageNumber);
|
||||
}
|
||||
@@ -709,7 +720,7 @@ void OBP60Task(GwApi *api){
|
||||
commonData.sundata = calcSunsetSunriseRTC(&commonData.data.rtcTime, homelat, homelon, tz);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Full display update afer a new selected page and 8s wait time
|
||||
if(millis() > starttime4 + 8000 && delayedDisplayUpdate == true){
|
||||
starttime1 = millis();
|
||||
@@ -786,8 +797,8 @@ void OBP60Task(GwApi *api){
|
||||
// getdisplay().nextPage(); // Partial update
|
||||
// getdisplay().nextPage(); // Partial update
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Refresh display data, default all 1s
|
||||
currentPage = pages[pageNumber].page;
|
||||
int pagetime = 1000;
|
||||
|
||||
@@ -189,6 +189,10 @@ public:
|
||||
{
|
||||
return api->getQueue();
|
||||
}
|
||||
virtual QueueHandle_t getKbQueue()
|
||||
{
|
||||
return api->getKbQueue();
|
||||
}
|
||||
virtual void sendN2kMessage(const tN2kMsg &msg,bool convert)
|
||||
{
|
||||
GWSYNCHRONIZED(mainLock);
|
||||
@@ -428,4 +432,4 @@ void GwUserCode::handleWebRequest(const String &url,AsyncWebServerRequest *req){
|
||||
}
|
||||
LOG_DEBUG(GwLog::DEBUG,"no task found for web request %s[%s]",url.c_str(),tname.c_str());
|
||||
req->send(404, "text/plain", "not found");
|
||||
}
|
||||
}
|
||||
|
||||
11
src/main.cpp
11
src/main.cpp
@@ -158,6 +158,8 @@ GwCounter<unsigned long> countNMEA2KIn("countNMEA2000in");
|
||||
GwCounter<unsigned long> countNMEA2KOut("countNMEA2000out");
|
||||
GwIntervalRunner timers;
|
||||
|
||||
QueueHandle_t keyboardQueue = NULL;
|
||||
|
||||
bool checkPass(String hash){
|
||||
return config.checkPass(hash);
|
||||
}
|
||||
@@ -269,6 +271,10 @@ public:
|
||||
{
|
||||
return &mainQueue;
|
||||
}
|
||||
virtual QueueHandle_t getKbQueue()
|
||||
{
|
||||
return keyboardQueue;
|
||||
}
|
||||
virtual void sendN2kMessage(const tN2kMsg &msg,bool convert)
|
||||
{
|
||||
handleN2kMessage(msg,sourceId,!convert);
|
||||
@@ -860,6 +866,8 @@ void setup() {
|
||||
webserver.begin();
|
||||
xdrMappings.begin();
|
||||
logger.flush();
|
||||
// remote keyboard support
|
||||
keyboardQueue = xQueueCreate(10, sizeof(uint8_t));
|
||||
GwConverterConfig converterConfig;
|
||||
converterConfig.init(&config,&logger);
|
||||
nmea0183Converter= N2kDataToNMEA0183::create(&logger, &boatData,
|
||||
@@ -869,7 +877,8 @@ void setup() {
|
||||
,
|
||||
config.getString(config.talkerId,String("GP")),
|
||||
&xdrMappings,
|
||||
converterConfig
|
||||
converterConfig,
|
||||
keyboardQueue
|
||||
);
|
||||
|
||||
toN2KConverter= NMEA0183DataToN2K::create(&logger,&boatData,[](const tN2kMsg &msg, int sourceId)->bool{
|
||||
|
||||
@@ -88,6 +88,16 @@
|
||||
"description":"the brightness of the led (0..255)",
|
||||
"category":"system"
|
||||
},
|
||||
{
|
||||
"name": "swBankInstance",
|
||||
"type": "number",
|
||||
"default": 0,
|
||||
"min": 0,
|
||||
"max": 252,
|
||||
"check": "checkMinMax",
|
||||
"description": "the instance of switch bank to receive data for (0..252)",
|
||||
"category": "system"
|
||||
},
|
||||
{
|
||||
"name": "talkerId",
|
||||
"label": "NMEA0183 ID",
|
||||
@@ -1287,4 +1297,4 @@
|
||||
"check": "checkXDR",
|
||||
"category": "xdr30"
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user