more refactor bug fixes
This commit is contained in:
Vendored
+1
@@ -129,6 +129,7 @@
|
||||
"carr",
|
||||
"CIPO",
|
||||
"COPI",
|
||||
"deadzone",
|
||||
"Doxygen",
|
||||
"Dutycycle",
|
||||
"gast",
|
||||
|
||||
@@ -1,157 +0,0 @@
|
||||
<diagram program="umletino" version="14.4.0-SNAPSHOT"><zoom_level>10</zoom_level><element><id>UMLClass</id><coordinates><x>750</x><y>10</y><w>220</w><h>650</h></coordinates><panel_attributes><<hardware>>
|
||||
MotorControl
|
||||
--
|
||||
- target_power: int8_t
|
||||
- power: int8_t
|
||||
- direction: uint8_t
|
||||
|
||||
|
||||
- pwm_pin: uint8_t
|
||||
- pwm_channel: uint8_t
|
||||
- pwm_res: uint8_t
|
||||
- dutycycle_min: uint8_t
|
||||
- dutycycle_max: uint8_t
|
||||
- direction_1: uint8_t
|
||||
- direction_2: uint8_t
|
||||
- delay: uint8_t
|
||||
- powersteps: uint8_t
|
||||
|
||||
- last_millis: uint32_t
|
||||
--
|
||||
+ MotorControl()
|
||||
+ init(pwm_pin: uint8_t,
|
||||
pwm_channel: uint8_t,
|
||||
dir_1: uint8_t, dir_2: uint8_t)
|
||||
+ loop(): uint16_t
|
||||
+ runMotorControl()
|
||||
|
||||
+ setMinPwm(uint8_t)
|
||||
+ setMaxPwm(uint8_t)
|
||||
+ setPowerSteps(uint8_t): uint16_t
|
||||
+ setTargetPower(uint8_t)
|
||||
+ setDelay(uint8_t): uint16_t
|
||||
|
||||
+ stop()
|
||||
+ emergencyStop()
|
||||
+ toString()
|
||||
+ getPower(): int8_t
|
||||
+ getTargetPower(): int8_t
|
||||
+ isTargetPowerReached(): bool
|
||||
+ isAccelerationPositive(): bool
|
||||
+ isAccelerationNegative(): bool
|
||||
|
||||
- setRealPower(power: int8_t)
|
||||
- increasePower(power: int8_t)
|
||||
|
||||
</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>80</x><y>380</y><w>220</w><h>330</h></coordinates><panel_attributes><<hardware>>
|
||||
Speedometer
|
||||
--
|
||||
- encoder: ESP32Encoder
|
||||
- debug: DebugMqtt*
|
||||
- name: String
|
||||
- speed: double = 0
|
||||
- last_millis: uint64_t = 0;
|
||||
- bufPos: uint8_t
|
||||
- buf: int16_t[BUF_SIZE]
|
||||
--
|
||||
+ Speedometer()
|
||||
+ init(pinA: uint8_t,
|
||||
pinB: uint8_t,
|
||||
name: String)
|
||||
+ runSpeedometer()
|
||||
+ setTargetPower(power: int8_t)
|
||||
+ getSpeed(): double
|
||||
+ getDirection(): uint8_t
|
||||
- addValToBuf(val: int16_t)
|
||||
- getAverage(): int16_t</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>70</x><y>0</y><w>270</w><h>370</h></coordinates><panel_attributes>MoveControl
|
||||
--
|
||||
- debug: DebugMqtt*
|
||||
- left_motor: MotorControl*
|
||||
- right_motor: MotorControl*
|
||||
- left_speedometer: Speedometer*
|
||||
- right_speedometer: Speedometer*
|
||||
- driving_status: DrivingStatus = stop
|
||||
- x_speed: double = 0
|
||||
- rotation_speed: double = 0
|
||||
- wheelspeed_left_target: double = 0
|
||||
- wheelspeed_right_target: double = 0
|
||||
--
|
||||
+ MoveControl()
|
||||
+ init(left_motor: MotorControl*,
|
||||
right_motor: MotorControl*,
|
||||
left_speedometer: Speedometer*,
|
||||
right_speedometer: Speedometer*)
|
||||
+ runMoveControl()
|
||||
+ setDrivingStatus(status: DrivingStatus)
|
||||
+ setSpeed(speed: double)
|
||||
+ setRotationspeed(speed: double)
|
||||
- calcWheelSpeed()
|
||||
- regulateMotors()</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>370</x><y>10</y><w>220</w><h>330</h></coordinates><panel_attributes><<driveModi>>
|
||||
ManualControl
|
||||
--
|
||||
- encoder: ESP32Encoder
|
||||
- debug: DebugMqtt*
|
||||
- name: String
|
||||
- speed: double = 0
|
||||
- last_millis: uint64_t = 0;
|
||||
- bufPos: uint8_t
|
||||
- buf: int16_t[BUF_SIZE]
|
||||
--
|
||||
+ Speedometer()
|
||||
+ init(pinA: uint8_t,
|
||||
pinB: uint8_t,
|
||||
name: String)
|
||||
+ runSpeedometer()
|
||||
+ setTargetPower(power: int8_t)
|
||||
+ getSpeed(): double
|
||||
+ getDirection(): uint8_t
|
||||
- addValToBuf(val: int16_t)
|
||||
- getAverage(): int16_t</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>1270</x><y>10</y><w>210</w><h>240</h></coordinates><panel_attributes>MenuControl
|
||||
--
|
||||
# parentMenu: MenuControl*
|
||||
# lcd: LiquidCrystal_I2C*
|
||||
--
|
||||
/+down()/
|
||||
/+up()/
|
||||
/+right()/
|
||||
/+left()/
|
||||
/+yes()/
|
||||
/+no()/
|
||||
|
||||
/+update()/
|
||||
/+printMenu()/
|
||||
|
||||
+ setParentMenu(MenuControl*)
|
||||
+ setLcd(LiquidCrystal_I2C*)</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>980</x><y>10</y><w>280</w><h>270</h></coordinates><panel_attributes>MenuAction
|
||||
--
|
||||
- name: char*
|
||||
|
||||
- *function: void
|
||||
- *callback: void
|
||||
|
||||
- isMenu: bool
|
||||
- menu: MenuControl
|
||||
--
|
||||
+ MenuAction(const char*, (*function), (*callback))
|
||||
+ MenuAction(const char*, (*function))
|
||||
+ MenuAction(const char*, MenuControl* menu)
|
||||
|
||||
+ runAction()
|
||||
|
||||
+ getName(): const char*
|
||||
+ getIsMenu(): bool
|
||||
+ getMenu(): MenuControl*
|
||||
</panel_attributes><additional_attributes></additional_attributes></element><element><id>UMLClass</id><coordinates><x>1220</x><y>360</y><w>280</w><h>160</h></coordinates><panel_attributes>Menu
|
||||
--
|
||||
- inSubmenu: bool
|
||||
|
||||
- entrys: list<MenuAction*>
|
||||
- selectedEntry: list<MenuAction*>::iterator
|
||||
|
||||
- isMenu: bool
|
||||
- menu: MenuControl
|
||||
--
|
||||
+ addEntry(MenuAction* entry)
|
||||
</panel_attributes><additional_attributes></additional_attributes></element><element><id>Relation</id><coordinates><x>1350</x><y>240</y><w>30</w><h>140</h></coordinates><panel_attributes>lt=<<-</panel_attributes><additional_attributes>10;10;10;120</additional_attributes></element><element><id>Relation</id><coordinates><x>1080</x><y>270</y><w>160</w><h>190</h></coordinates><panel_attributes>lt=-
|
||||
m1=*
|
||||
m2=0..1</panel_attributes><additional_attributes>10;10;10;160;140;160</additional_attributes></element></diagram>
|
||||
@@ -1,390 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<diagram program="umlet" version="14.3.0">
|
||||
<zoom_level>10</zoom_level>
|
||||
<element>
|
||||
<id>UMLSpecialState</id>
|
||||
<coordinates>
|
||||
<x>40</x>
|
||||
<y>20</y>
|
||||
<w>20</w>
|
||||
<h>20</h>
|
||||
</coordinates>
|
||||
<panel_attributes>type=initial</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>40</x>
|
||||
<y>20</y>
|
||||
<w>130</w>
|
||||
<h>30</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=<-</panel_attributes>
|
||||
<additional_attributes>110.0;10.0;10.0;10.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLState</id>
|
||||
<coordinates>
|
||||
<x>150</x>
|
||||
<y>10</y>
|
||||
<w>100</w>
|
||||
<h>40</h>
|
||||
</coordinates>
|
||||
<panel_attributes>search next point
|
||||
bg=green</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLSpecialState</id>
|
||||
<coordinates>
|
||||
<x>180</x>
|
||||
<y>90</y>
|
||||
<w>40</w>
|
||||
<h>40</h>
|
||||
</coordinates>
|
||||
<panel_attributes>bg=green
|
||||
type=decision</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>190</x>
|
||||
<y>40</y>
|
||||
<w>30</w>
|
||||
<h>70</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=<-</panel_attributes>
|
||||
<additional_attributes>10.0;50.0;10.0;10.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLState</id>
|
||||
<coordinates>
|
||||
<x>150</x>
|
||||
<y>180</y>
|
||||
<w>100</w>
|
||||
<h>40</h>
|
||||
</coordinates>
|
||||
<panel_attributes>detect alignment
|
||||
bg=green</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>190</x>
|
||||
<y>120</y>
|
||||
<w>130</w>
|
||||
<h>80</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=<-
|
||||
[distance <= 5m]</panel_attributes>
|
||||
<additional_attributes>10.0;60.0;10.0;10.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLObject</id>
|
||||
<coordinates>
|
||||
<x>20</x>
|
||||
<y>0</y>
|
||||
<w>840</w>
|
||||
<h>590</h>
|
||||
</coordinates>
|
||||
<panel_attributes>Autopilot
|
||||
|
||||
valign=top</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>210</x>
|
||||
<y>90</y>
|
||||
<w>140</w>
|
||||
<h>40</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=<-
|
||||
[distance > 5m]</panel_attributes>
|
||||
<additional_attributes>120.0;20.0;10.0;20.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLState</id>
|
||||
<coordinates>
|
||||
<x>330</x>
|
||||
<y>90</y>
|
||||
<w>100</w>
|
||||
<h>40</h>
|
||||
</coordinates>
|
||||
<panel_attributes>Error
|
||||
bg=red</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLState</id>
|
||||
<coordinates>
|
||||
<x>150</x>
|
||||
<y>270</y>
|
||||
<w>100</w>
|
||||
<h>40</h>
|
||||
</coordinates>
|
||||
<panel_attributes>correct alignment
|
||||
bg=green</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLState</id>
|
||||
<coordinates>
|
||||
<x>150</x>
|
||||
<y>360</y>
|
||||
<w>100</w>
|
||||
<h>40</h>
|
||||
</coordinates>
|
||||
<panel_attributes>drive to point
|
||||
bg=green</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>190</x>
|
||||
<y>210</y>
|
||||
<w>30</w>
|
||||
<h>80</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=<-</panel_attributes>
|
||||
<additional_attributes>10.0;60.0;10.0;10.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>190</x>
|
||||
<y>300</y>
|
||||
<w>30</w>
|
||||
<h>80</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=<-</panel_attributes>
|
||||
<additional_attributes>10.0;60.0;10.0;10.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>90</x>
|
||||
<y>280</y>
|
||||
<w>80</w>
|
||||
<h>120</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=<-</panel_attributes>
|
||||
<additional_attributes>60.0;10.0;10.0;10.0;10.0;100.0;60.0;100.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLState</id>
|
||||
<coordinates>
|
||||
<x>440</x>
|
||||
<y>10</y>
|
||||
<w>410</w>
|
||||
<h>300</h>
|
||||
</coordinates>
|
||||
<panel_attributes>detect alignment
|
||||
valign=top</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLSpecialState</id>
|
||||
<coordinates>
|
||||
<x>460</x>
|
||||
<y>60</y>
|
||||
<w>20</w>
|
||||
<h>20</h>
|
||||
</coordinates>
|
||||
<panel_attributes>type=final</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>470</x>
|
||||
<y>60</y>
|
||||
<w>90</w>
|
||||
<h>30</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=-></panel_attributes>
|
||||
<additional_attributes>10.0;10.0;70.0;10.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLState</id>
|
||||
<coordinates>
|
||||
<x>540</x>
|
||||
<y>50</y>
|
||||
<w>110</w>
|
||||
<h>40</h>
|
||||
</coordinates>
|
||||
<panel_attributes>drive 1m forward</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLState</id>
|
||||
<coordinates>
|
||||
<x>540</x>
|
||||
<y>140</y>
|
||||
<w>110</w>
|
||||
<h>40</h>
|
||||
</coordinates>
|
||||
<panel_attributes>drive 2m backward</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLState</id>
|
||||
<coordinates>
|
||||
<x>540</x>
|
||||
<y>230</y>
|
||||
<w>110</w>
|
||||
<h>40</h>
|
||||
</coordinates>
|
||||
<panel_attributes>drive 1m forward</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLState</id>
|
||||
<coordinates>
|
||||
<x>700</x>
|
||||
<y>230</y>
|
||||
<w>120</w>
|
||||
<h>40</h>
|
||||
</coordinates>
|
||||
<panel_attributes>calculate straight line</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>580</x>
|
||||
<y>80</y>
|
||||
<w>30</w>
|
||||
<h>80</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=<-</panel_attributes>
|
||||
<additional_attributes>10.0;60.0;10.0;10.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>580</x>
|
||||
<y>170</y>
|
||||
<w>30</w>
|
||||
<h>80</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=<-</panel_attributes>
|
||||
<additional_attributes>10.0;60.0;10.0;10.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLSpecialState</id>
|
||||
<coordinates>
|
||||
<x>750</x>
|
||||
<y>150</y>
|
||||
<w>20</w>
|
||||
<h>20</h>
|
||||
</coordinates>
|
||||
<panel_attributes>type=termination</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>750</x>
|
||||
<y>160</y>
|
||||
<w>30</w>
|
||||
<h>90</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=<-</panel_attributes>
|
||||
<additional_attributes>10.0;10.0;10.0;70.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLState</id>
|
||||
<coordinates>
|
||||
<x>440</x>
|
||||
<y>320</y>
|
||||
<w>410</w>
|
||||
<h>260</h>
|
||||
</coordinates>
|
||||
<panel_attributes>correct alignment
|
||||
valign=top</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLState</id>
|
||||
<coordinates>
|
||||
<x>540</x>
|
||||
<y>370</y>
|
||||
<w>190</w>
|
||||
<h>40</h>
|
||||
</coordinates>
|
||||
<panel_attributes>calculate relativ target position</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>470</x>
|
||||
<y>380</y>
|
||||
<w>90</w>
|
||||
<h>30</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=-></panel_attributes>
|
||||
<additional_attributes>10.0;10.0;70.0;10.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLSpecialState</id>
|
||||
<coordinates>
|
||||
<x>460</x>
|
||||
<y>380</y>
|
||||
<w>20</w>
|
||||
<h>20</h>
|
||||
</coordinates>
|
||||
<panel_attributes>type=final</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLState</id>
|
||||
<coordinates>
|
||||
<x>580</x>
|
||||
<y>460</y>
|
||||
<w>120</w>
|
||||
<h>40</h>
|
||||
</coordinates>
|
||||
<panel_attributes>rotate x degree</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>630</x>
|
||||
<y>400</y>
|
||||
<w>30</w>
|
||||
<h>80</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=<-</panel_attributes>
|
||||
<additional_attributes>10.0;60.0;10.0;10.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>630</x>
|
||||
<y>490</y>
|
||||
<w>30</w>
|
||||
<h>80</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=<-</panel_attributes>
|
||||
<additional_attributes>10.0;60.0;10.0;10.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLSpecialState</id>
|
||||
<coordinates>
|
||||
<x>630</x>
|
||||
<y>550</y>
|
||||
<w>20</w>
|
||||
<h>20</h>
|
||||
</coordinates>
|
||||
<panel_attributes>type=termination</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
</diagram>
|
||||
@@ -1,45 +1,6 @@
|
||||
Maybe:
|
||||
-> Time Measurement in component interface
|
||||
-> Time warnings
|
||||
|
||||
Do later:
|
||||
-> Program underfloorLighting
|
||||
-> Add an beeper
|
||||
-> Program the beeper
|
||||
-> Engine slow down without curve in motorControl
|
||||
-> Network clean up (Mqtt remove?)
|
||||
-> Extra class for maneuver, autopilot should inherit from int16_t
|
||||
-> Remote Control
|
||||
- Leds for gnss rtk etc
|
||||
- what happens exactly when no data is arriving
|
||||
-> Test Menu for big curve driving
|
||||
-> Api with Names and show on Maps in Browser
|
||||
-> Menu structure mit add functions for each menu mit pointer return to config (additional not replace)
|
||||
-> Menu Display from parent as run() to make Menu as Component
|
||||
-> Racing Mode
|
||||
-> ConsolControl
|
||||
-> Menü für Einstellungen
|
||||
- WiFi (save in Flash)
|
||||
-> Battery
|
||||
- tabelle mit eigenen Werten übergeben und nicht in header (wiederverwendbarkeit)
|
||||
- kalibrierungsmethode mit Menü
|
||||
- Daten in flash speichern können
|
||||
-> Check speration between Ui and Route (RouteMenu)
|
||||
-> update sparkfun gnss auf v3 für SPI korrekturdatenüvbetragung
|
||||
-> Rover Objekt mit Error zustand freeze, damit das wenn möglich auch auf dem Display angezeigt wird.
|
||||
-> ESP und Sensoren in den DeepSleep für Auschalten oder Akkuschutz
|
||||
-> Doxygen comments
|
||||
- navigation
|
||||
- autopilot
|
||||
|
||||
|
||||
Do now:
|
||||
Code:
|
||||
Fernbedienung!
|
||||
|
||||
Latex:
|
||||
Anhang: Liste mit allen Komponenten und Kurzbeschreibung
|
||||
Unterschied funktionale und nicht funktionale Anforderungen
|
||||
Overfull H-Boxen
|
||||
Test Motor, Zeiten kontrolieren. Wenn einfach so dann bezug auf fehler bei Timing und freeRtos
|
||||
Was mit den nicht erfüllten Anforderungen machen?
|
||||
|
||||
@@ -87,6 +87,7 @@ public:
|
||||
* @param status
|
||||
*/
|
||||
void setDrivingStatus(Status status);
|
||||
Status getDrivingStatus() const { return this->driving_status; }
|
||||
|
||||
/**
|
||||
* @brief Stops the engine immediately
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define HW1
|
||||
#define HOTSPOT
|
||||
|
||||
#ifdef HOTSPOT
|
||||
namespace NetworkConfig
|
||||
|
||||
Submodule
+1
Submodule lib/Menu added at 35b1478666
@@ -33,6 +33,7 @@ void MotorControl::init(uint8_t pwmPin, uint8_t pwmChannel, uint8_t dir_1, uint8
|
||||
ledcSetup(this->pwmChannel, MotorControl::pwmFreq, MotorControl::pwmRes);
|
||||
ledcAttachPin(this->pwmPin, this->pwmChannel);
|
||||
ledcWrite(this->pwmChannel, 0);
|
||||
std::cout << "Init pwm" << std::endl;
|
||||
}
|
||||
|
||||
void MotorControl::run()
|
||||
@@ -56,7 +57,7 @@ void MotorControl::run()
|
||||
return;
|
||||
}
|
||||
|
||||
// Positive or negative tagret speed
|
||||
// Positive or negative target speed
|
||||
if (this->targetPower >= 0)
|
||||
{
|
||||
// Positive or negative speed
|
||||
@@ -97,28 +98,6 @@ void MotorControl::run()
|
||||
}
|
||||
}
|
||||
|
||||
void MotorControl::setMinPwm(uint8_t min)
|
||||
{
|
||||
if (min > MotorControl::maxPwmMin)
|
||||
{
|
||||
min = MotorControl::maxPwmMin;
|
||||
}
|
||||
// transform percentage to real pwm value
|
||||
min = static_cast<uint8_t>(((static_cast<uint8_t>(1) << pwmRes) - 1) * (min / 100.0));
|
||||
this->dutycycleMin = min;
|
||||
}
|
||||
|
||||
void MotorControl::setMaxPwm(uint8_t max)
|
||||
{
|
||||
if (max > 100)
|
||||
{
|
||||
max = 100;
|
||||
}
|
||||
// transform percentage to real pwm value
|
||||
max = static_cast<uint8_t>(((static_cast<uint8_t>(1) << pwmRes) - 1) * (max / 100.0));
|
||||
this->dutycycleMax = max;
|
||||
}
|
||||
|
||||
void MotorControl::setTargetPower(int8_t power)
|
||||
{
|
||||
if (power <= 100 && power >= -100)
|
||||
@@ -174,10 +153,11 @@ void MotorControl::setRealPower(int8_t power)
|
||||
digitalWrite(this->dir_2, LOW);
|
||||
ledcWrite(this->pwmChannel, 0);
|
||||
this->dutycycle = 0;
|
||||
std::cout << "abort" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
const uint8_t pwm_val = map(abs(power), 0, 100, this->dutycycleMin, this->dutycycleMax);
|
||||
const uint8_t pwm_val = map(abs(power), 0, 100, MotorControl::minPwmVal, MotorControl::maxPwmVal);
|
||||
|
||||
if ((this->direction == 1 || this->direction == 0) && power < 0)
|
||||
{ // new direction backward
|
||||
@@ -192,6 +172,7 @@ void MotorControl::setRealPower(int8_t power)
|
||||
digitalWrite(this->dir_2, LOW);
|
||||
}
|
||||
|
||||
std::cout << "MotorControl::setRealPower pwm_val: " << (int) pwm_val << " channel:" << (int) this->pwmChannel << std::endl;
|
||||
ledcWrite(this->pwmChannel, pwm_val);
|
||||
this->dutycycle = pwm_val;
|
||||
}
|
||||
|
||||
@@ -38,20 +38,6 @@ public:
|
||||
*/
|
||||
void init(uint8_t pwmPin, uint8_t pwmChannel, uint8_t dir_1, uint8_t dir_2);
|
||||
|
||||
/**
|
||||
* @brief Set the minimum duty cycle
|
||||
*
|
||||
* @param min duty cycle in percent
|
||||
*/
|
||||
void setMinPwm(uint8_t min);
|
||||
|
||||
/**
|
||||
* @brief Set the maximum duty cycle
|
||||
*
|
||||
* @param max duty cycle in percent
|
||||
*/
|
||||
void setMaxPwm(uint8_t max);
|
||||
|
||||
/**
|
||||
* @brief Set the Target Power
|
||||
*
|
||||
@@ -103,6 +89,8 @@ private:
|
||||
static constexpr uint8_t pwmRes = 8;
|
||||
static constexpr uint8_t powerSteps = 2; // A total of 20 levels ( 100 / SPEED_STEPS ) * RUN_MOTOR_CONTROL_DELAY = 500ms
|
||||
static constexpr uint8_t maxPwmMin = 80;
|
||||
static constexpr uint8_t maxPwmVal = 250;
|
||||
static constexpr uint8_t minPwmVal = 55; // Max 98% of 2^PWM_RES
|
||||
|
||||
int8_t targetPower = 0;
|
||||
int8_t power = 0;
|
||||
@@ -111,8 +99,6 @@ private:
|
||||
uint8_t pwmPin = 0;
|
||||
uint8_t pwmChannel = 0;
|
||||
uint16_t dutycycle = 0;
|
||||
uint8_t dutycycleMin = 55;
|
||||
uint8_t dutycycleMax = 98; // Max 98% of 2^PWM_RES
|
||||
uint8_t dir_1 = 0;
|
||||
uint8_t dir_2 = 0;
|
||||
};
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#define SENSOR_DATA_H
|
||||
|
||||
#include <SPI.h>
|
||||
#include <I2Cdev.h>
|
||||
#include <iostream>
|
||||
|
||||
#include "component.h"
|
||||
|
||||
+2
-22
@@ -15,16 +15,14 @@ board_build.partitions = no_ota.csv
|
||||
framework = arduino
|
||||
monitor_speed = 115200
|
||||
upload_speed = 921600
|
||||
; monitor_port = COM6
|
||||
monitor_port = COM6
|
||||
lib_deps =
|
||||
https://git.kleiax.de/PlatformIO-Libs/SparkFunGNSS.git
|
||||
knolleary/PubSubClient@^2.8
|
||||
br3ttb/PID@^1.2.1
|
||||
marcoschwartz/LiquidCrystal_I2C@^1.1.4
|
||||
bblanchon/ArduinoJson@^6.20.0
|
||||
mprograms/QMC5883LCompass@^1.2.0
|
||||
jrowberg/I2Cdevlib-MPU6050@^1.0.0
|
||||
; upload_port = COM6
|
||||
upload_port = COM6
|
||||
test_ignore = test_desktop
|
||||
build_type = debug
|
||||
monitor_filters = esp32_exception_decoder
|
||||
@@ -42,21 +40,3 @@ test_ignore = test_embedded
|
||||
|
||||
[platformio]
|
||||
description = A Rover who should be drive a route by gps.
|
||||
|
||||
|
||||
; Bei Möglichkeit folgendes aus clang tidy entfernen
|
||||
; cppcoreguidelines-owning-memory
|
||||
;
|
||||
;
|
||||
;
|
||||
;
|
||||
;
|
||||
;
|
||||
;
|
||||
;
|
||||
;
|
||||
;
|
||||
;
|
||||
;
|
||||
;
|
||||
#
|
||||
|
||||
@@ -48,7 +48,6 @@ void MenuDriveMode::left()
|
||||
|
||||
this->firstPrint = true;
|
||||
this->configureOnLeave();
|
||||
delete this->menuSpeed;
|
||||
this->driveManager->changeModus();
|
||||
MenuInformationSites::left();
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ void ManualControl::analogControl()
|
||||
|
||||
void ManualControl::digitalControl()
|
||||
{
|
||||
static constexpr uint8_t deadzone = 120;
|
||||
static constexpr uint8_t deadzone = 110;
|
||||
const int16_t yAxis = this->input->x - 127;
|
||||
const int16_t xAxis = this->input->y - 127;
|
||||
|
||||
|
||||
+6
-2
@@ -129,12 +129,16 @@ void setup()
|
||||
{
|
||||
wifiIndicator = '-';
|
||||
}
|
||||
|
||||
lcdWrapper = new LcdWrapper(lcd);
|
||||
lcdWrapper->setCallback(lcdWrapperCallback);
|
||||
lcdWrapper->loop();
|
||||
|
||||
lcd->backlight();
|
||||
lcd->setCursor(0, 0);
|
||||
lcd->printf("%c Kleiax-Rover %c", wifiIndicator, wifiIndicator);
|
||||
lcd->setCursor(0, 1);
|
||||
lcd->printf("WiFi channel %u", Network::getCurrentChannel());
|
||||
lcdWrapper = new LcdWrapper(lcd);
|
||||
lcdWrapper->setCallback(lcdWrapperCallback);
|
||||
|
||||
makeMenu();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user