Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESC Setup / programming (bidirectional telemetry / forward programming) - implemented for YGE and Scorpion ESCs #108

Merged
merged 107 commits into from
May 13, 2024

Conversation

bob01
Copy link
Contributor

@bob01 bob01 commented Apr 28, 2024

ESC setup / programming (forward programming) using the Tx via bidirectional telemetry #101, includes #78

Complete for YGE and Scorpion ESCs.
HobbyWing V5 in the works, POC looking good -available soon if no showstoppers.

  • Both implemented on a common request / response finite state machine (rrfsm) which handles bidirectional and unidirectional communication with the ESC. Adding other ESC protocols is relatively easy.
  • Common ESC parameter read(collection) and write pattern
  • Common MSP transport w/ opaque payload serving all supported ESC between FC and Tx,
    ie transport is common, serialization/deserialization of payload at FC is part of per ESC support code.
    Transmitter tools are outside the scope of this project - per manufacturer scripts not tied to RF release cycle.
    Working reference implementations for YGE, Scorpion and HobbyWing (soon) are provided.

Configuration

  • enable one-wire bidirectional (half-duplex) communication on ESC telemetry sensor port
    set esc_sensor_halfduplex = ON
  • half duplex operation requires the ESC to be connected to the Tx pin instead of the Rx pin
    Instead of modifying our telemetry cables we opt to address this with resource configuration as some of our chosen flight controllers don't have Tx pins on some uarts and we don't want to create non-standard telemetry cables.
    e.g. for FDF722 v2
    # resources
    resource SERIAL_RX 3 NONE
    resource SERIAL_TX 3 C11

Code

  • escSensorInit: sets callback to function returned by protocol initialization method which shall initialize protocol and rrfsm as appropriate for half or full duplex operation. rrfsmDataReceive usually returned.

  • escSensorProcess: delegates to rrfsmSensorProcess(...) which is a basic FSM which...

    • handles reporting of sync, crc errors, timeouts, frame counts
    • sequencing write activity
    • delegating configured handlers for accepting and decoding incoming character stream
    • handling self echo on writes
  • no protocol specific code here.

  • 2x new MSP commands

    • MSP_ESC_PARAMETERS (217)
      Writes paramBuffer if complete set of ESC parameters received from device and ready for editing, false otherwise
    • MSP_SET_ESC_PARAMETERS (218)
      Reads into paramUpdBuffer then calls paramCommit callback (configured in protocol init) which returns true on success or false otherwise
  • Common parameter patterns

    • interface is paramBuffer, paramUpdBuffer, paramPayloadLength and paramCommit(...)
    • paramBuffer and paramUpdBuffer are exchanged by MSP as described above. There is a short header which contains
      • ESC specific signature: detects mis-matches between ESC and Tx app (Lua script for RadioMaster)
      • flags+version: param protocol version, read-only flag, user option (e.g. ESC reset)
    • protocol is considered to be in 'readonly' mode if paramCommit is not set (say if esc_sensor_halfduplex == OFF).
      UI shall not display 'Save' or 'User' options in this case
    • parameters collected / read from ESC in to paramBuffer
    • parameters considered 'ready' only when complete set available, protocol indicates ready by setting paramPayloadLength to the length of data in paramBuffer, 0 otherwise.
      UI shall display 'ESC not ready...' in this case
    • protocol's paramCommit implementation shall perform change detection between paramUpdBuffer received from MSP and paramBuffer to avoid unnecessary write operations against the ESC. Dirty parameters shall be indicated.
  • Common RRFSM pattern

    • configurable boot delay as most ESCs take several seconds to fully initialize
    • assuming the master role
      • if ESC starts sending frames after init FC shall wait for first frame and send first request shortly after. This avoids the need for collision detection. Specific examples below.
      • if ESC starts in slave mode FC shall send first request during initial quiet time
    • next request is scheduled for frame-period after previous response. Pending requests are sent one at a time until there are none remaining in the following order...
      • special commands like ESC reset if supported / needed are first
      • pending ESC write requests to update parameters flagged dirty are scheduled next. Dirty flag is immediately reset - there are no retries.
      • pending ESC read requests to fetch stale or missing parameters are scheduled next
      • request next telemetry frame if nothing else

Each ESC's behaviour, capabilities and parameter set is different - discussed below

YGE support

  • configure FC and ESC telemetry protocol as "OpenYGE"
  • Requires OpenYGE v3 (FW 1.03551) or later
  • initializes in AUTO_TELE mode and begins sending unsolicited TELE_AUTO packets (like full duplex operation)
  • FC assumes master role after receipt of first TELE_AUTO packet and sends the first TELE_REQ packet
    (unless is < v3 packet in which case FC reverts to AUTO_TELE mode and will not try to assume master role until next bootup)
  • ESC assumes slave role, stops send unsolicited packets and responds with TELE_RESP packet
  • FC schedules next TELE_REQ request on receiving response for next frame period. Exact timing is imprecise '38' was found to produce a result close enough to 50ms frame period
  • each REQ packet header contains a rotating sequence number, matching response header will include this seq number
  • YGE parameters are 16 bit indexed values. v3 defines 32
  • ESC sends 1 parameter round-robin with each telemetry packet so complete collection is received in about 32 x 50ms in 1600ms. There is no need for an explicit 'get parameter(s)' request. Collection is made available to MSP when all have been received.
  • oygeParamCommit(...) applies change detection to avoid unnecessary writes, sets each. changed parameter's dirty bit and invalidates it in the parameter collection, collection is now unavailable to MSP
  • FC schedules WRITE_PARAM_REQ (instead of TELE_REQ) for dirty param and clears param's dirty bit - there are no retries
  • ESC responds with WRITE_PARAM_RESP which is exactly the same format as regular TELE_RESP but will break the parameter round-robin and include the parameter value just written. Parameter is cached as before and if collection is complete it is once again made available to MSP
  • User may view and change parameters at any time when safe to do so (on the ground/disamed recommended of course).
    Changes are immediate, no restart required - can be done as often as needed, e.g. setup, flight tuning internal gov PIDs etc.
    Note: ESC will ignore write requests if the motor is turning
    Note: All ESC responses are in the same frame format w/ TELE_AUTO being slightly different as it's seq # will always be 0.
    Note: ESC sends parameters even in AUTO_TELE mode ie these can be viewed on the Tx (read only MSP) even if when serial port not configured for bidirectional communication

Scorpion Tribunus

  • Requires v63 or later
  • configure FC and ESC telemetry protocol as 'UNC'
    initial req / response implementation as per documentation for 'Scorpion' protocol was functional but contents were encrypted so was set aside and later removed in favour of UNC workaround - may be revisit later
  • ESC waits for ~ 10 seconds after power on, if a request to read status region is received during this time it will abort entry to UNC mode permanently / until reset
  • if undisturbed ESC enters UNC mode, starts sending telemetry data and stops respond to requests, just like before
  • if MSP activity is detected during this quiet time flag paramMspActive is set
  • UNCSETUPFSM detects paramMspActive and sends a READ_STATUS request - response confirms that UNC was successfully stopped, UNCSETUPFSM into ACTIVE state
  • UNCSETUPFSM triggers the next request pattern as needed. Once triggered the next request is triggered by the previous response until there are no more
    • commands first
    • parameter writes, next
    • parameter reads
    • back to UNCSETUPFSM
  • paramBuffer is packed with ranges of parameters from multiple regions - these ranges are declared in tribParamAddrLen
  • entries from tribParamAddrLen are used...
    • to build ESC read requests - each entry specifying region, address and length - results are packed into paramBuffer for MSP, parameters made available when collection is complete
    • perform change detection on paramUpdBuffer in paramCommit(...) and later build ESC write requests from changes unpacked from paramUpdBuffer from MSP
  • User must be ready to enter any page in the Tx app ASAP to abort UNC to view and change parameters therefore this option is available only at startup.
    Restart required to apply changes and restart UNC telemetry data
  • 'ESC Reset' provided as param 'user option' and is presented along with 'Save' on menu
  • There is a certain interesting thing that can be done because this setup communication happens outside of the ESC's configured protocol

Testing

  • YGE: Tested w/ several 205HV, 135 Aureus v1 and v2's since mid-March - has been in general use in more than 6 helis for the last month or so.
  • Scorpion: Tested w/ 80A and 130A ESCs (v63) in 2 helis since late Feb
    No known outstanding issues with either.

UI for YGE

image
image
image
image
image
image

UI for Scorpion - connect to Scorpion ASAP on startup, reset when done (power cycle or use menu option)

image
image
image
image
image
image
image
image
image

bob01 added 30 commits February 8, 2024 21:43
…capture of non-standard data (for ESC's with additional temperature sensors, status codes, error flags etc)
…ETX settings (ratio etc) with recognizable values for ESC supplied reuse sources
* esc_sensor_openyge:
  OpenYGE - frame updates for frame version 1

# Conflicts:
#	src/main/sensors/esc_sensor.c
* esc_sensor_openyge:
  OpenYGE - final protocol refinements, requires ESC firmware v1.03543 or greater

# Conflicts:
#	src/main/sensors/esc_sensor.c
* esc_sensor_openyge:
  OpenYGE - final protocol refinements, requires ESC firmware v1.03543 or greater - validate frame type
* esc_sensor_openyge:
  OpenYGE - enable single-wire for future bidirectional use
* esc_sensor_openyge:
  OpenYGE - enable single-wire for future bidirectional use, enable txrx mode
- assume min frame length of 6 until known
- apply 0-> -40°C, 255->215°C temperature mapping (frame version >= 2)
- minor code cleanups
bob01 added 9 commits April 15, 2024 10:04
* esc_sensor_data_plus: (21 commits)
  RFF-78 - escSensorData - added .throttle to. capture input setpoint as reported by ESC
  Fix Kontronik telemetry protocol (rotorflight#98)
  Update README.md
  Add Horizon mode inverted self-leveling
  Add CI or PR to the firmware extra version string
  OpenYGE - fix: address possible buffer underflow condition, add 2nd paranoid frame length validation outside ISR/callback (rotorflight#96)
  Fix RPM filter error check with Direct Drive motors (rotorflight#94)
  Fix TTA headroom calculation in Gov Passthrough (rotorflight#92)
  Add GOV_MODE FrSky telemetry sensor (rotorflight#89)
  Add github workflows for CI builds
  OpenYGE - telemetry - BEC voltage and current fix
  OpenYGE - fix to support v3 frame header extension (rotorflight#87)
  OpenYGE - support v3 frame header extension - documentation
  chore: fixed scale lights terminology (rotorflight#85)
  Add Releases.md
  Update github workflows
  Reduce default smoothing level
  Simplify RC frame rate calculation
  Change default PID D-gains
  Change default motor protocol to PWM
  ...

# Conflicts:
#	src/main/sensors/esc_sensor.c
* master:
  Fix for CMS feature disabled issue on Spektrum telemetry (rotorflight#106)
  Update CMS flight profile menus (rotorflight#104)
  Auto detection fix for Kontronik ESCs (rotorflight#100)
@@ -1106,21 +1008,30 @@ static void kontronikSensorProcess(timeUs_t currentTimeUs)
uint32_t crc = kontronikDecodeCRC(kontronikPacketLength - KON_CRC_LENGTH);
if (calculateCRC32(buffer, kontronikPacketLength - kontronikCrcExclude - KON_CRC_LENGTH) == crc) {
uint32_t rpm = buffer[7] << 24 | buffer[6] << 16 | buffer[5] << 8 | buffer[4];
int16_t throttle = (int8_t)buffer[24];
Copy link
Owner

@rotorflight rotorflight Apr 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be negative? Why the (int8_t)?
I guess so, as it has +100 later. Must be -100..100 then.

Copy link
Contributor Author

@bob01 bob01 Apr 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly - docs say ...
* 24: Throttle % (-100..100)
ie apply offset for 0-200, then scale *5 to be equivalent to .pwm 0..100 (*10)
escSensorData[0].throttle = (throttle + 100) * 5;
escSensorData[0].pwm = pwm * 10;

uint16_t currBEC = buffer[19] << 8 | buffer[18];
uint16_t voltBEC = buffer[21] << 8 | buffer[20];
uint16_t status1 = buffer[29] << 8 | buffer[28];
uint16_t status2 = buffer[31] << 8 | buffer[30];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not collect the status directly into a uint32_t?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Evolutionary leftovers - collecting as 32 done.

serialWriteBuf(escSensorPort, reqbuffer, reqLength);
}

static void rrfsmInvalidateReq()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C-convention. Should be (void)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed - done.

return paramPayloadLength != 0 ? PARAM_HEADER_SIZE + paramPayloadLength : 0;
}

uint8_t *escGetParamBuffer()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(void)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

return paramBuffer;
}

uint8_t *escGetParamUpdBuffer()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(void)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

return paramUpdBuffer;
}

bool escCommitParameters()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(void)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

const uint32_t q22 = 1 << 22;
uint32_t *pw = iq22Payload;
uint32_t *pp = (uint32_t*)(paramUpdPayload + offset);
*pw++ = (((double)*pp++) / 100 * q22);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is double used here? First, STM32F7/F4 does not support double, so this would be enumlated.
Second. I am not sure why use double/float at all, as this is all integers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IQ22 float conversion required better precision than w/ integer only math.
test - expected is 150
const uint32_t q22 = 1 << 22;
uint32_t iqv = 0x00001893; // <= from ESC
uint32_t d1= round(((double)iqv) * 100000 / q22);
uint32_t d2 = ((uint32_t)iqv) * 100000 / q22;
printf("\niq22> %d, %d", d1, d2);
output
iq22> 150, 149

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could do it correctly with integers, but it would look ugly.
Please use float instead. Double is trouble.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verifying use of float w/ unit tests prior to change...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

float passes tests - float replaces double

const uint32_t q22 = 1 << 22;
uint32_t *pr = (uint32_t*)(buffer + TRIB_HEADER_LENGTH);
uint32_t *pp = (uint32_t*)(paramPayload + offset);
*pp++ = round(((double)*pr++) / q22 * 100);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question about the use of double.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above.
These are the gov P and I parameters - one option would be not to present them but some like to use the ESC's internal governor and expect to be able to tweak these. Odd choice by Scorpion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

float replaces double

Copy link
Owner

@rotorflight rotorflight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use float instead of double

uint32_t *pr = (uint32_t*)(buffer + TRIB_HEADER_LENGTH);
uint32_t *pp = (uint32_t*)(paramPayload + offset);
*pp++ = round(((float)*pr++) / q22 * 100);
*pp = round(((float)*pr) / q22 * 100000);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

round() takes a double argument, causing a promotion float -> double.
You need to use roundf()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, the joys of implicit coercion round(...) replaced with roundf(...), tests and device tests ok

Copy link
Owner

@rotorflight rotorflight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nearly there. You missed the round() function. Use roundf() instead.

@rotorflight
Copy link
Owner

Most floating point functions in C are taking double. Need to use the ...f() variant for floats.
Also, all constants need to be suffixed with f, like 1.234f. Otherwise they are double.
It's easy to miss these... BF code use to be full of unnecessary conversions and slow code.

…undf(...) - unit and device tests ok for range of values used
@bob01
Copy link
Contributor Author

bob01 commented May 10, 2024

Good catch - thanks

@rotorflight rotorflight merged commit be50b72 into rotorflight:master May 13, 2024
1 check passed
bob01 added a commit to bob01/rotorflight-firmware that referenced this pull request May 13, 2024
* Added OpenYGE transport - TODO frame deserialization

* Implemented support for progressive decreasing frame-period during ramp time

* Implemented OpenYGE frame deserializer

* ESC frame byte alignment workaround

* Remove byte alignment workaround, v1.03539 frames good

* Added OpenYGE status1 documentation (motor status) - TODO: warning flags

* Added status / warning flag documentation

* Added status / warning flag documentation

* More documentation, fix BB ESC_SENSOR and ESC_SENSOR_DATA values - DEBUG_DATA_EXTRA is BEC voltage

* OpenYGE - capture BEC temperature as escSensorData.temperature2

* Capture DEBUG_FRAME_BUFFER (use readBytes vs bufferPos)

* escSensorData - added temperature3 (for ESC's with additional temperature sensors), bec_voltage and bec_current

* escSensorData - esc sensor parity for gps reuse sources

* escSensorData - replaced .temperature3 with .extra1 and .extra2, for capture of non-standard data  (for ESC's with additional temperature sensors, status codes, error flags etc)

* escSensorData - added ESC sensor protocol CALIBRATE - use to dial in ETX settings (ratio etc) with recognizable values for ESC supplied reuse sources

* escSensorData - expose new common ESC telemetry fields as reuse sources

* OpenYGE - frame updates for frame version 1

* OpenYGE - final protocol refinements, requires ESC firmware v1.03543 or greater

* OpenYGE - final protocol refinements, requires ESC firmware v1.03543 or greater - validate frame type

* ESC setup - MSP UI POC - max MSP buffer seems to be btwn 80 and 128 then silent fails

* OpenYGE - enable single-wire for future bidirectional use

* OpenYGE - enable single-wire for future bidirectional use

* OpenYGE - enable single-wire for future bidirectional use, enable txrx mode

* OpenYGE - reduced ramp interval based on 3543 LA captures
- assume min frame length of 6 until known
- apply 0-> -40°C, 255->215°C temperature mapping (frame version >= 2)
- minor code cleanups

* OpenYGE - disable single-wire telemetry for initial release (ie use RX pin)

* ESC Setup - msp - dont send any parameter data until all parameters cached
YGE - derive parameter count from parameters received

* YGE ESC - msp - save

* ESC Setup - minor cosmetic

* Tribunus - poc - added request/response one-wire protocol variant

* Tribunus - poc - add request/response one-wire protocol variant - wip

* Tribunus - poc - add request/response one-wire protocol variant - wip 1

* Tribunus - poc - add request/response one-wire protocol variant - wip 2

* RFF-78 - escdata - escSensorData_t extended to capture esc provided BEC voltage/current, ESC status / fault codes

* RFF-78 - reuse - additional CRSF reuse sources to expose extended esc sensor data

* ESC MSP - more generic impl pulled back from more advanced branch

* Tribunus - poc - add request/response one-wire protocol variant - wip 3

* Tribunus - poc - add request/response one-wire protocol variant - wip 4

* ESC Setup - Scorpion ported and validated on RRFSM (shared request/response FSM), OpenYGE ported to RRFSM

* ESC Setup - OpenYGE validated on RRFSM

* ESC Setup - Scorpion setup params - wip

* ESC Setup - Scorpion setup params - wip2

* SCORP ESC - extended payload to include stick min/max Us

* ESC Setup - Scorpion setup params - UNC test

* ESC Setup - RRFSM validation

* OpenYGE - reverted temp offset change (original implementation was correct)

* OpenYGE - save param - wip

* OpenYGE - save param - RFP-02 impl

* ESC Setup - hack / poc to validate scorpion read/write while in UNC mode

* ESC Setup - scorpion read/write while in UNC mode - cleanup of secondary state machine

* ESC Setup - scorpion read/write while in UNC mode - cleanup of secondary state machine - verified

* ESC Setup - scorpion - support IQ22 settings gov P and I

* ESC Setup - scorpion - support IQ22 settings gov P and I

* ESC Setup - scorpion - msp params extended to include ESC commands, added 'reset ESC' option

* ESC Setup - minor code cleanup

* OpenYGE - support v3 frame header extension

* OpenYGE - support v3 frame header extension - documentation

(cherry picked from commit 00fc315)

* OpenYGE - support v3 frame header extension - documentation

(cherry picked from commit 00fc315)
(cherry picked from commit a1d7b16)

* ESC Setup - RRFSM / serial port init cleanup

* ESC Setup - support PARAM_HEADER_RDONLY (0x40) e.g. no bidirectional connection to ESC

* Tribunus - const cleanup

* OpenYGE - ESC_SENSOR voltage and current fixes

* OpenYGE - const cleanup

* OpenYGE - draft bidirectional impl w/ fallback to auto mode, structs to pack and parse packets

* OpenYGE - draft bidirectional impl. cosmetic and doc cleanup

* ESC Setup - parameter exchange cleanup

* OpenYGE - telemetry - BEC voltage and current fix

* OpenYGE - telemetry - BEC voltage and current fix

* OpenYGE - master - assume role after last auto telemetry frame w/ delay for chained responses

* OpenYGE - master - assume role ~24ms quiet time after seeing v3 auto telemetry frame, support TELE_AUTO, TELE_REQ/RESP, WRITE_PARAM_REQ/RESP

* OpenYGE - setup - params read only if frame_version < v3

* ESC Setup - params - invalidate param payload and param on param commit, wait until param written and subsequently read before making param payload available again.
ESC capability / command cleanup

* OpenYGE - fix: address possible frame underflow condition, add 2nd paranoid frame length validation outside ISR/callback, declare globals shared w/ callback volatile

* ESC status - send reserved bit to force recognition of status == 0

* RFF-78 - escSensorData - added .throttle to. capture input setpoint as reported by ESC

* REUSE - added BEC, BUS, MPU voltage sources to GPS sensor options

* CRSF - reuse - expose additional ESC sources on ATT 16-bit sensors - not enough room on GPS sensors

* CRSF - reuse - minor code consistency - missing comma

* ESC Setup - scorpion - unc timeout fixes, minor cosmetics

* ESC Setup - scorpion - remove enc telemetry data

* ESC Setup - pre-pr code cosmetics, more defined constants, removed deprecated unc

* hd - void signature fixes, kon status as 32 bit

* hd - IQ22 - use float vs double - tests ok for range of values used

* hd - IQ22 - improper use of round(...) w/ float type, replace with roundf(...)  - unit and device tests ok for range of values used

---------

Co-authored-by: Rotorflight <[email protected]>
bob01 added a commit to bob01/rotorflight-firmware that referenced this pull request May 13, 2024
* master:
  Add ESC Forward programming for YGE and Scorpion ESCs (rotorflight#108)
  Improve yaw precomp filtering
  Fix Governor Passthrough IDLE state throttle tracking
  Use servo pulse limits for output throttle
  Change gov_max_throttle range to 0..100%
  Fix CMS label alignment on small screen (rotorflight#109)
  Add CMS Rescue, PID controller and bandwidth menus (rotorflight#107)
  Fix hover drift in PID mode 3
  Fix for CMS feature disabled issue on Spektrum telemetry (rotorflight#106)
  Update CMS flight profile menus (rotorflight#104)
  Auto detection fix for Kontronik ESCs (rotorflight#100)

# Conflicts:
#	src/main/sensors/esc_sensor.c
@bob01
Copy link
Contributor Author

bob01 commented May 14, 2024

Yay - thanks.

bob01 added a commit to bob01/rotorflight-firmware that referenced this pull request Jun 5, 2024
* Added OpenYGE transport - TODO frame deserialization

* Implemented support for progressive decreasing frame-period during ramp time

* Implemented OpenYGE frame deserializer

* ESC frame byte alignment workaround

* Remove byte alignment workaround, v1.03539 frames good

* Added OpenYGE status1 documentation (motor status) - TODO: warning flags

* Added status / warning flag documentation

* Added status / warning flag documentation

* More documentation, fix BB ESC_SENSOR and ESC_SENSOR_DATA values - DEBUG_DATA_EXTRA is BEC voltage

* OpenYGE - capture BEC temperature as escSensorData.temperature2

* Capture DEBUG_FRAME_BUFFER (use readBytes vs bufferPos)

* escSensorData - added temperature3 (for ESC's with additional temperature sensors), bec_voltage and bec_current

* escSensorData - esc sensor parity for gps reuse sources

* escSensorData - replaced .temperature3 with .extra1 and .extra2, for capture of non-standard data  (for ESC's with additional temperature sensors, status codes, error flags etc)

* escSensorData - added ESC sensor protocol CALIBRATE - use to dial in ETX settings (ratio etc) with recognizable values for ESC supplied reuse sources

* escSensorData - expose new common ESC telemetry fields as reuse sources

* OpenYGE - frame updates for frame version 1

* OpenYGE - final protocol refinements, requires ESC firmware v1.03543 or greater

* OpenYGE - final protocol refinements, requires ESC firmware v1.03543 or greater - validate frame type

* ESC setup - MSP UI POC - max MSP buffer seems to be btwn 80 and 128 then silent fails

* OpenYGE - enable single-wire for future bidirectional use

* OpenYGE - enable single-wire for future bidirectional use

* OpenYGE - enable single-wire for future bidirectional use, enable txrx mode

* OpenYGE - reduced ramp interval based on 3543 LA captures
- assume min frame length of 6 until known
- apply 0-> -40°C, 255->215°C temperature mapping (frame version >= 2)
- minor code cleanups

* OpenYGE - disable single-wire telemetry for initial release (ie use RX pin)

* ESC Setup - msp - dont send any parameter data until all parameters cached
YGE - derive parameter count from parameters received

* YGE ESC - msp - save

* ESC Setup - minor cosmetic

* Tribunus - poc - added request/response one-wire protocol variant

* Tribunus - poc - add request/response one-wire protocol variant - wip

* Tribunus - poc - add request/response one-wire protocol variant - wip 1

* Tribunus - poc - add request/response one-wire protocol variant - wip 2

* RFF-78 - escdata - escSensorData_t extended to capture esc provided BEC voltage/current, ESC status / fault codes

* RFF-78 - reuse - additional CRSF reuse sources to expose extended esc sensor data

* ESC MSP - more generic impl pulled back from more advanced branch

* Tribunus - poc - add request/response one-wire protocol variant - wip 3

* Tribunus - poc - add request/response one-wire protocol variant - wip 4

* ESC Setup - Scorpion ported and validated on RRFSM (shared request/response FSM), OpenYGE ported to RRFSM

* ESC Setup - OpenYGE validated on RRFSM

* ESC Setup - Scorpion setup params - wip

* ESC Setup - Scorpion setup params - wip2

* SCORP ESC - extended payload to include stick min/max Us

* ESC Setup - Scorpion setup params - UNC test

* ESC Setup - RRFSM validation

* OpenYGE - reverted temp offset change (original implementation was correct)

* OpenYGE - save param - wip

* OpenYGE - save param - RFP-02 impl

* ESC Setup - hack / poc to validate scorpion read/write while in UNC mode

* ESC Setup - scorpion read/write while in UNC mode - cleanup of secondary state machine

* ESC Setup - scorpion read/write while in UNC mode - cleanup of secondary state machine - verified

* ESC Setup - scorpion - support IQ22 settings gov P and I

* ESC Setup - scorpion - support IQ22 settings gov P and I

* ESC Setup - scorpion - msp params extended to include ESC commands, added 'reset ESC' option

* ESC Setup - minor code cleanup

* OpenYGE - support v3 frame header extension

* OpenYGE - support v3 frame header extension - documentation

(cherry picked from commit 00fc315)

* OpenYGE - support v3 frame header extension - documentation

(cherry picked from commit 00fc315)
(cherry picked from commit a1d7b16)

* ESC Setup - RRFSM / serial port init cleanup

* ESC Setup - support PARAM_HEADER_RDONLY (0x40) e.g. no bidirectional connection to ESC

* Tribunus - const cleanup

* OpenYGE - ESC_SENSOR voltage and current fixes

* OpenYGE - const cleanup

* OpenYGE - draft bidirectional impl w/ fallback to auto mode, structs to pack and parse packets

* OpenYGE - draft bidirectional impl. cosmetic and doc cleanup

* ESC Setup - parameter exchange cleanup

* OpenYGE - telemetry - BEC voltage and current fix

* OpenYGE - telemetry - BEC voltage and current fix

* OpenYGE - master - assume role after last auto telemetry frame w/ delay for chained responses

* OpenYGE - master - assume role ~24ms quiet time after seeing v3 auto telemetry frame, support TELE_AUTO, TELE_REQ/RESP, WRITE_PARAM_REQ/RESP

* OpenYGE - setup - params read only if frame_version < v3

* ESC Setup - params - invalidate param payload and param on param commit, wait until param written and subsequently read before making param payload available again.
ESC capability / command cleanup

* OpenYGE - fix: address possible frame underflow condition, add 2nd paranoid frame length validation outside ISR/callback, declare globals shared w/ callback volatile

* ESC status - send reserved bit to force recognition of status == 0

* RFF-78 - escSensorData - added .throttle to. capture input setpoint as reported by ESC

* REUSE - added BEC, BUS, MPU voltage sources to GPS sensor options

* CRSF - reuse - expose additional ESC sources on ATT 16-bit sensors - not enough room on GPS sensors

* CRSF - reuse - minor code consistency - missing comma

* ESC Setup - scorpion - unc timeout fixes, minor cosmetics

* ESC Setup - scorpion - remove enc telemetry data

* ESC Setup - pre-pr code cosmetics, more defined constants, removed deprecated unc

* hd - void signature fixes, kon status as 32 bit

* hd - IQ22 - use float vs double - tests ok for range of values used

* hd - IQ22 - improper use of round(...) w/ float type, replace with roundf(...)  - unit and device tests ok for range of values used

---------

Co-authored-by: Rotorflight <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants