Skip to content

Commit

Permalink
Sending ign/start via Telemetry TX
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzoveliki committed Jun 18, 2024
1 parent e1e6e2e commit 2abdb59
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
20 changes: 17 additions & 3 deletions libraries/AP_EFI/AP_EFI_Serial_FH.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ AP_EFI_Serial_FH::AP_EFI_Serial_FH(AP_EFI &_frontend):
}

static unsigned char boza = 0;

#include "../AP_ICEngine/AP_ICEngine.h"
void AP_EFI_Serial_FH::update()
{
const uint32_t now = AP_HAL::millis();
Expand Down Expand Up @@ -95,8 +95,22 @@ void AP_EFI_Serial_FH::update()

void AP_EFI_Serial_FH::send_request(void)
{
static uint8_t d[] = { 0, 'A', 'L', 'F', '!' };
d[0]=boza;
static uint8_t d[] = { 0, 0, 'A', 'L', 'F' };

uint8_t kur=0;
switch (AP::ice()->state) {

case AP_ICEngine::ICE_DISABLED: kur = 0xFF; break;
case AP_ICEngine::ICE_OFF: kur = 0; break;
case AP_ICEngine::ICE_START_HEIGHT_DELAY:
case AP_ICEngine::ICE_START_DELAY: kur = 1; break;
case AP_ICEngine::ICE_STARTING: kur = 2; break;
case AP_ICEngine::ICE_RUNNING: kur = 3; break;
default:break;
}

d[0] = boza;
d[1] = kur;
// const uint32_t crc = ~crc_crc32(~0U, &d[2], sizeof(d)-2);
// const uint32_t crc2 = htobe32(crc);
port->write(d, sizeof(d));
Expand Down
3 changes: 3 additions & 0 deletions libraries/AP_EFI/AP_EFI_Serial_FH.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@
#include "AP_EFI.h"
#include "AP_EFI_Backend.h"

#include "../AP_ICEngine/AP_ICEngine.h"

class AP_EFI_Serial_FH: public AP_EFI_Backend {

friend AP_ICEngine;
public:
// Constructor with initialization
AP_EFI_Serial_FH(AP_EFI &_frontend);
Expand Down
2 changes: 1 addition & 1 deletion libraries/AP_ICEngine/AP_ICEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class AP_ICEngine {

static AP_ICEngine *get_singleton() { return _singleton; }

private:
//!!private:
static AP_ICEngine *_singleton;

void set_ignition(bool on);
Expand Down

0 comments on commit 2abdb59

Please sign in to comment.