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:
@@ -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; \
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user