add init stage 4
This commit is contained in:
parent
3d26efd6ea
commit
197e1360d4
@ -2,7 +2,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "actuators.h"
|
#include "actuators.h"
|
||||||
|
|
||||||
void actuatorsInit() {
|
bool actuatorsInit() {
|
||||||
pinMode(PIN_LB, OUTPUT);
|
pinMode(PIN_LB, OUTPUT);
|
||||||
pinMode(PIN_LF, OUTPUT);
|
pinMode(PIN_LF, OUTPUT);
|
||||||
pinMode(PIN_RB, OUTPUT);
|
pinMode(PIN_RB, OUTPUT);
|
||||||
@ -14,8 +14,15 @@ void actuatorsInit() {
|
|||||||
ledcAttachPin(L_PWM_PIN, PWM_CH_L);
|
ledcAttachPin(L_PWM_PIN, PWM_CH_L);
|
||||||
ledcAttachPin(R_PWM_PIN, PWM_CH_R);
|
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);
|
actuatorsSetSpeed(150, 150);
|
||||||
actuatorsStop();
|
actuatorsStop();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void actuatorsStop() {
|
void actuatorsStop() {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
void actuatorsInit();
|
bool actuatorsInit();
|
||||||
void actuatorsStop();
|
void actuatorsStop();
|
||||||
|
|
||||||
void actuatorsForward();
|
void actuatorsForward();
|
||||||
|
|||||||
@ -44,15 +44,19 @@ void runStartupChecks() {
|
|||||||
"", "");
|
"", "");
|
||||||
delay(DELAY_FOR_STARTUP_CHECKS);
|
delay(DELAY_FOR_STARTUP_CHECKS);
|
||||||
|
|
||||||
// TODO: Этап 4-5 (другие проверки)
|
// Этап 4: Проверка моторов (actuators)
|
||||||
oledSetStage(4, TOTAL_STAGES);
|
oledSetStage(4, TOTAL_STAGES);
|
||||||
|
bool actuatorsOk = actuatorsInit();
|
||||||
|
oledShowMain(actuatorsOk ? "Motors: OK" : "Motors: FAIL",
|
||||||
|
"", "", "");
|
||||||
delay(DELAY_FOR_STARTUP_CHECKS);
|
delay(DELAY_FOR_STARTUP_CHECKS);
|
||||||
|
|
||||||
|
// Этап 5: Проверка WiFi
|
||||||
oledSetStage(5, TOTAL_STAGES);
|
oledSetStage(5, TOTAL_STAGES);
|
||||||
delay(DELAY_FOR_STARTUP_CHECKS);
|
delay(DELAY_FOR_STARTUP_CHECKS);
|
||||||
|
|
||||||
// Все проверки пройдены
|
// Все проверки пройдены
|
||||||
oledSetSystemReady(joyOk && servoOk && ultrasonicOk);
|
oledSetSystemReady(joyOk && servoOk && ultrasonicOk && actuatorsOk);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
@ -63,7 +67,6 @@ void setup() {
|
|||||||
// Запуск проверок
|
// Запуск проверок
|
||||||
runStartupChecks();
|
runStartupChecks();
|
||||||
|
|
||||||
actuatorsInit();
|
|
||||||
webServerInit();
|
webServerInit();
|
||||||
wsInit();
|
wsInit();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user