* introducing external MLink module telemetry as module PPM subtype * implemented fix for sensor discovery display not showing all detected sensors (is in separate PR too) implemented PPM subtypes in Companion * add PPM subtype to model printer finalize subtypes for PPM in Companion * added logic to try to use HW UART with inverters turned off first (e.g. NV14), then, if not successfull use soft serial inverted (== uninverted data due to HW inverters on PCB) changed start bit detection IRQ priority from 5 to the previous 0 (also in separate PR) * extended telemetry timeout to 2s due to slow Mlink RSSI update rate * changed the "NOTLM" sub-type texts to: - "No Telem" for 128x64 (this is the max numbers of characters it can take) - "No Telemetry" everything else including Companion * Companion: - lower case 1st charachter on PpmSubTypeStrings to ppmSubTypeStrings - added telemetry hooks for ppmSubTypeStrings stringx * simplified serial port initialization for MLink telemetry * editorial change: corrected obsolete comment
69 lines
2.3 KiB
C
69 lines
2.3 KiB
C
/*
|
|
* Copyright (C) EdgeTX
|
|
*
|
|
* Based on code named
|
|
* opentx - https://github.com/opentx/opentx
|
|
* th9x - http://code.google.com/p/th9x
|
|
* er9x - http://code.google.com/p/er9x
|
|
* gruvin9x - http://code.google.com/p/gruvin9x
|
|
*
|
|
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
enum {
|
|
MLINK_VOLTAGE = 1,
|
|
MLINK_CURRENT = 2,
|
|
MLINK_VARIO = 3,
|
|
MLINK_SPEED = 4,
|
|
MLINK_RPM = 5,
|
|
MLINK_TEMP = 6,
|
|
MLINK_HEADING = 7,
|
|
MLINK_ALT = 8,
|
|
MLINK_FUEL = 9,
|
|
MLINK_LQI = 10,
|
|
MLINK_CAPACITY = 11,
|
|
MLINK_FLOW = 12,
|
|
MLINK_DISTANCE = 13,
|
|
MLINK_GRATE = 14,
|
|
MLINK_RX_VOLTAGE = 16, // out of range ID for specific RxBt treatment
|
|
MLINK_LOSS = 17, // out of range ID for handling number of loss
|
|
MLINK_TX_RSSI = 18, // out of range ID for handling Telemetry RSSi reported by multi
|
|
MLINK_TX_LQI = 19, // out of range ID for handling Telemetry LQI reported by multi
|
|
MLINK_SPECIAL = 20, // out of raneg ID fro handling special value class
|
|
};
|
|
|
|
#define MLINK_SVC 0 // ID speial value class - can't use in enum as indexes have to start at 0
|
|
|
|
void mlinkSetDefault(int index, uint16_t id, uint8_t subId, uint8_t instance);
|
|
|
|
// Used by multi protocol
|
|
void processMLinkPacket(const uint8_t *packet, bool multi);
|
|
|
|
// used by telemetry driver
|
|
#define MSB_EXT_MODULE_PACKET_LEN 18 // packet length minus start and stop byte
|
|
#define MSB_STX 0x02 // start byte
|
|
#define MSB_ETX 0x03 // stop byte
|
|
#define MSB_STUFF_ESC 0x1B // ESC symbol
|
|
#define MSB_STUFF_OFFSET 0x20 // byte stuffing offset
|
|
#define MSB_VALID_TELEMETRY 0x13
|
|
#define MSB_NORMAL 0x06
|
|
#define MSB_NORMAL_FAST 0x04
|
|
#define MSB_RANGE 0x46
|
|
#define MSB_RANGE_FAST 0x44
|
|
|
|
// used by external MLink module driver
|
|
#define PPM_MSB_BAUDRATE 115200
|
|
|
|
void processExternalMLinkSerialData(void* ctx, uint8_t data, uint8_t* buffer, uint8_t* len);
|