1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-14 06:23:07 +01:00

allow to convert 2 rudder instances

This commit is contained in:
andreas
2024-03-02 19:59:00 +01:00
parent ebd4a8907a
commit 71f0bfa6f3
8 changed files with 82 additions and 26 deletions

View File

@@ -89,6 +89,7 @@
class GWDMS22B : public SSISensor{
int zero=2047;
bool invt=false;
public:
using SSISensor::SSISensor;
virtual bool preinit(GwApi * api){
@@ -105,7 +106,8 @@ class GWDMS22B : public SSISensor{
LOG_DEBUG(GwLog::ERROR,"unable to measure %s: %d",prefix.c_str(),(int)res);
}
double resolved=(((int)value-zero)*360.0/mask);
LOG_DEBUG(GwLog::LOG,"measure %s : %d, resolved: %f",prefix.c_str(),value,(float)resolved);
if (invt) resolved=-resolved;
LOG_DEBUG(GwLog::DEBUG,"measure %s : %d, resolved: %f",prefix.c_str(),value,(float)resolved);
tN2kMsg msg;
SetN2kRudder(msg,DegToRad(resolved),iid);
api->sendN2kMessage(msg);
@@ -116,6 +118,7 @@ class GWDMS22B : public SSISensor{
CFG_GET(iid,PRFX); \
CFG_GET(fintv,PRFX); \
CFG_GET(zero,PRFX); \
CFG_GET(invt,PRFX); \
bits=12; \
clock=500000; \
cs=GW ## PRFX ## _CS; \

View File

@@ -12,6 +12,7 @@
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
//for SSI refer to https://www.posital.com/media/posital_media/documents/AbsoluteEncoders_Context_Technology_SSI_AppNote.pdf
#ifndef _GWSPISENSOR_H
#define _GWSPISENSOR_H
#include <driver/spi_master.h>

View File

@@ -6,12 +6,12 @@
{
"b": "1",
"i": "11",
"n": "11"
"n": "0"
},
{
"b": "1",
"i": "12",
"n": "12"
"n": "1"
},
{
"b": "1",
@@ -86,6 +86,17 @@
"capabilities": {
"DMS22B$i": "true"
}
},
{
"name": "DMS22B$iinvt",
"label": "DMS22BX$i invert",
"type": "boolean",
"default": "false",
"description": "Invert the direction of the $i. SSI DMS22B rotary encoder (bus $b)",
"category": "spisensors$b",
"capabilities": {
"DMS22B$i": "true"
}
}
]
}