add init stage 4

This commit is contained in:
cheykrym 2026-03-30 04:10:03 +03:00
parent 3d26efd6ea
commit 197e1360d4
3 changed files with 15 additions and 5 deletions

View File

@ -2,7 +2,7 @@
#include "config.h"
#include "actuators.h"
void actuatorsInit() {
bool actuatorsInit() {
pinMode(PIN_LB, OUTPUT);
pinMode(PIN_LF, OUTPUT);
pinMode(PIN_RB, OUTPUT);
@ -14,8 +14,15 @@ void actuatorsInit() {
ledcAttachPin(L_PWM_PIN, PWM_CH_L);
ledcAttachPin(R_PWM_PIN, PWM_CH_R);
Serial.println("Actuators initialized");
Serial.printf(" L_PWM → GPIO%d\n", L_PWM_PIN);
Serial.printf(" R_PWM → GPIO%d\n", R_PWM_PIN);
Serial.printf(" L_DIR → GPIO%d, %d\n", PIN_LB, PIN_LF);
Serial.printf(" R_DIR → GPIO%d, %d\n", PIN_RB, PIN_RF);
actuatorsSetSpeed(150, 150);
actuatorsStop();
return true;
}
void actuatorsStop() {

View File

@ -1,6 +1,6 @@
#pragma once
void actuatorsInit();
bool actuatorsInit();
void actuatorsStop();
void actuatorsForward();

View File

@ -44,15 +44,19 @@ void runStartupChecks() {
"", "");
delay(DELAY_FOR_STARTUP_CHECKS);
// TODO: Этап 4-5 (другие проверки)
// Этап 4: Проверка моторов (actuators)
oledSetStage(4, TOTAL_STAGES);
bool actuatorsOk = actuatorsInit();
oledShowMain(actuatorsOk ? "Motors: OK" : "Motors: FAIL",
"", "", "");
delay(DELAY_FOR_STARTUP_CHECKS);
// Этап 5: Проверка WiFi
oledSetStage(5, TOTAL_STAGES);
delay(DELAY_FOR_STARTUP_CHECKS);
// Все проверки пройдены
oledSetSystemReady(joyOk && servoOk && ultrasonicOk);
oledSetSystemReady(joyOk && servoOk && ultrasonicOk && actuatorsOk);
}
void setup() {
@ -63,7 +67,6 @@ void setup() {
// Запуск проверок
runStartupChecks();
actuatorsInit();
webServerInit();
wsInit();