move esc code to separate class FactoryEsc#60
move esc code to separate class FactoryEsc#60AlexShutov wants to merge 1 commit intoopenppg:masterfrom
Conversation
|
Hi and thanks for this. I've done something similar, but it has not been merged into master branch just yet. The new ESC we are testing uses CAN bus, so it's an entirely different protocol. We are probably moving away from PWM and UART reading of ESCs but I will look into having the ability to read and write to different types of ESCs in the future. |
I saw this branch, but not sure if Tmotor thunder has CAN bus support. There is also HobbyWing Xrotor esc, I thought about buying that one, but is has 120a continious current, It looks safer to use TMotor 300A Regarding code, It seems worth abstracting protocol level (uart, CAN) to different class for sending and receiving packets and passing it by pointer into Esc implementation. I would also extract Logger and TelemetryCalculator for making code cleaner, so this logic will know nothing about esc protocol. We can merge changes in this PR and make another class CanBaseEsc : EscBase, contract looks the same, and then implement throttle level calculators. On startup see config and use proper implementation Unfortunately I don't have PPG for testing this code, only dev board for 2040. Ordered screen, vibration control on ali |
Hi, is that good idea? |

Esc code support only factory esc. I want to use T-motor Thunder 300A 24S esc, ordered it, but don't know format of data from that esc. So maybe it is a good idea to add support for several esc's.
In this pr esc interface is moved to abstrace EscBase class and existing code is moved to FactoryEsc class.
State of battery and esc is also moved to separate struct, singleton instance of which is created in .ino file instead of using 'extern' variables