send n2k message for rudder angle
This commit is contained in:
parent
0c94293ccb
commit
ebd4a8907a
|
@ -14,6 +14,7 @@
|
||||||
*/
|
*/
|
||||||
#include "GWDMS22B.h"
|
#include "GWDMS22B.h"
|
||||||
#include "GwApi.h"
|
#include "GwApi.h"
|
||||||
|
#include "N2kMessages.h"
|
||||||
|
|
||||||
|
|
||||||
#define CHECK_BUS(BUS) \
|
#define CHECK_BUS(BUS) \
|
||||||
|
@ -87,12 +88,12 @@
|
||||||
|
|
||||||
|
|
||||||
class GWDMS22B : public SSISensor{
|
class GWDMS22B : public SSISensor{
|
||||||
uint32_t zero=2047;
|
int zero=2047;
|
||||||
public:
|
public:
|
||||||
using SSISensor::SSISensor;
|
using SSISensor::SSISensor;
|
||||||
virtual bool preinit(GwApi * api){
|
virtual bool preinit(GwApi * api){
|
||||||
GwLog *logger=api->getLogger();
|
GwLog *logger=api->getLogger();
|
||||||
LOG_DEBUG(GwLog::LOG,"DMS22B configured, prefix=%s, intv=%f",prefix.c_str());
|
LOG_DEBUG(GwLog::LOG,"DMS22B configured, prefix=%s, intv=%f",prefix.c_str(),fintv);
|
||||||
api->addCapability(prefix,"true");
|
api->addCapability(prefix,"true");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -103,7 +104,11 @@ class GWDMS22B : public SSISensor{
|
||||||
if (res != ESP_OK){
|
if (res != ESP_OK){
|
||||||
LOG_DEBUG(GwLog::ERROR,"unable to measure %s: %d",prefix.c_str(),(int)res);
|
LOG_DEBUG(GwLog::ERROR,"unable to measure %s: %d",prefix.c_str(),(int)res);
|
||||||
}
|
}
|
||||||
LOG_DEBUG(GwLog::LOG,"measure %s : %d",prefix.c_str(),value);
|
double resolved=(((int)value-zero)*360.0/mask);
|
||||||
|
LOG_DEBUG(GwLog::LOG,"measure %s : %d, resolved: %f",prefix.c_str(),value,(float)resolved);
|
||||||
|
tN2kMsg msg;
|
||||||
|
SetN2kRudder(msg,DegToRad(resolved),iid);
|
||||||
|
api->sendN2kMessage(msg);
|
||||||
}
|
}
|
||||||
#define DMS22B(PRFX,...) \
|
#define DMS22B(PRFX,...) \
|
||||||
if (prefix == #PRFX) {\
|
if (prefix == #PRFX) {\
|
||||||
|
|
|
@ -80,7 +80,7 @@
|
||||||
"name": "DMS22B$izero",
|
"name": "DMS22B$izero",
|
||||||
"label": "DMS22B$i Zero",
|
"label": "DMS22B$i Zero",
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"default": 2,
|
"default": 2048,
|
||||||
"description": "Zero position (0...2^bits-1)",
|
"description": "Zero position (0...2^bits-1)",
|
||||||
"category": "spisensors$b",
|
"category": "spisensors$b",
|
||||||
"capabilities": {
|
"capabilities": {
|
||||||
|
|
Loading…
Reference in New Issue