Commit Graph

4 Commits

Author SHA1 Message Date
GarandPLG 1f849e3455 Refactor Engine: remove begin() and dedupe helpers
Removed the empty Engine::begin() method and its declaration.

Moved getRPM, getSpeedKmh, rpmToPwm, and setMotor implementations to the
top of Engine.cpp and deleted their duplicate definitions at the bottom.

Fixed wheel motor PWM calculation by using the raw wheelRPM instead of
wheelRPM * 10.0f.

Deleted the call to engine.begin() in the Arduino setup.
2026-06-17 05:49:37 +02:00
GarandPLG 6c0a1fc15b Make car mass configurable at runtime
Replace the compile‑time CAR_MASS constant with a runtime‑settable
_member _carMass. Add Engine::setCarMass, default it to 1200 kg, and
use it in the acceleration calculation. Prompt the user for the
car mass on startup via Serial and update the enable/disable messages.
2026-06-17 00:13:16 +02:00
GarandPLG 23d5003788 Add PWM motor control and refactor engine update
Introduce ENA pins for both motors and implement rpmToPwm and setMotor.
Replace extensive Serial debug prints with concise motor‑drive logic in
Engine::update. Consolidate sonar pins into a single TRIG_AND_ECHO_PIN.
Update pinMode calls in the sketch to configure the new ENA pins.
2026-06-16 23:35:23 +02:00
GarandPLG b957a0701b Add Engine class and integrate it into Projekt
Add clutch, brake, and throttle pin constants to Config.h.
Implement Engine class in Engine.h/Engine.cpp to read analog inputs,
compute engine RPM, vehicle speed, and apply forces.
Create an Engine instance in Projekt.ino, initialize it in setup,
and update it every 20ms, displaying RPM and speed.
2026-06-16 11:08:56 +02:00