mirror of
https://github.com/okalachev/flix.git
synced 2026-01-11 13:36:43 +00:00
Compare commits
4 Commits
4d70018d73
...
stm
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c3b818c2ae | ||
|
|
531b3f4d04 | ||
|
|
795b248b94 | ||
|
|
77c4b5fc5b |
7
.github/workflows/build.yml
vendored
7
.github/workflows/build.yml
vendored
@@ -29,6 +29,13 @@ jobs:
|
|||||||
run: sed -i 's/^#define WIFI_ENABLED 1$/#define WIFI_ENABLED 0/' flix/flix.ino && make
|
run: sed -i 's/^#define WIFI_ENABLED 1$/#define WIFI_ENABLED 0/' flix/flix.ino && make
|
||||||
- name: Check c_cpp_properties.json
|
- name: Check c_cpp_properties.json
|
||||||
run: tools/check_c_cpp_properties.py
|
run: tools/check_c_cpp_properties.py
|
||||||
|
- name: Build for Black Pill F411CE (STM32)
|
||||||
|
run: |
|
||||||
|
arduino-cli config set board_manager.additional_urls https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json
|
||||||
|
arduino-cli core install STMicroelectronics:stm32
|
||||||
|
arduino-cli board listall STMicroelectronics:stm32
|
||||||
|
arduino-cli lib install "Preferences"
|
||||||
|
make BOARD=STMicroelectronics:stm32:GenF4:pnum=BLACKPILL_F411CE
|
||||||
|
|
||||||
build_macos:
|
build_macos:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
|
|||||||
@@ -25,13 +25,15 @@ const int MOTOR_FRONT_LEFT = 3;
|
|||||||
|
|
||||||
void setupMotors() {
|
void setupMotors() {
|
||||||
print("Setup Motors\n");
|
print("Setup Motors\n");
|
||||||
|
#ifdef ESP32
|
||||||
// configure pins
|
|
||||||
ledcAttach(MOTOR_0_PIN, PWM_FREQUENCY, PWM_RESOLUTION);
|
ledcAttach(MOTOR_0_PIN, PWM_FREQUENCY, PWM_RESOLUTION);
|
||||||
ledcAttach(MOTOR_1_PIN, PWM_FREQUENCY, PWM_RESOLUTION);
|
ledcAttach(MOTOR_1_PIN, PWM_FREQUENCY, PWM_RESOLUTION);
|
||||||
ledcAttach(MOTOR_2_PIN, PWM_FREQUENCY, PWM_RESOLUTION);
|
ledcAttach(MOTOR_2_PIN, PWM_FREQUENCY, PWM_RESOLUTION);
|
||||||
ledcAttach(MOTOR_3_PIN, PWM_FREQUENCY, PWM_RESOLUTION);
|
ledcAttach(MOTOR_3_PIN, PWM_FREQUENCY, PWM_RESOLUTION);
|
||||||
|
#else
|
||||||
|
analogWriteResolution(PWM_RESOLUTION);
|
||||||
|
analogWriteFrequency(PWM_FREQUENCY);
|
||||||
|
#endif
|
||||||
sendMotors();
|
sendMotors();
|
||||||
print("Motors initialized\n");
|
print("Motors initialized\n");
|
||||||
}
|
}
|
||||||
@@ -45,10 +47,10 @@ int getDutyCycle(float value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void sendMotors() {
|
void sendMotors() {
|
||||||
ledcWrite(MOTOR_0_PIN, getDutyCycle(motors[0]));
|
analogWrite(MOTOR_0_PIN, getDutyCycle(motors[0]));
|
||||||
ledcWrite(MOTOR_1_PIN, getDutyCycle(motors[1]));
|
analogWrite(MOTOR_1_PIN, getDutyCycle(motors[1]));
|
||||||
ledcWrite(MOTOR_2_PIN, getDutyCycle(motors[2]));
|
analogWrite(MOTOR_2_PIN, getDutyCycle(motors[2]));
|
||||||
ledcWrite(MOTOR_3_PIN, getDutyCycle(motors[3]));
|
analogWrite(MOTOR_3_PIN, getDutyCycle(motors[3]));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool motorsActive() {
|
bool motorsActive() {
|
||||||
|
|||||||
@@ -6,8 +6,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#ifdef ESP32
|
||||||
#include <soc/soc.h>
|
#include <soc/soc.h>
|
||||||
#include <soc/rtc_cntl_reg.h>
|
#include <soc/rtc_cntl_reg.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
const float ONE_G = 9.80665;
|
const float ONE_G = 9.80665;
|
||||||
extern float t;
|
extern float t;
|
||||||
@@ -37,7 +39,9 @@ float wrapAngle(float angle) {
|
|||||||
|
|
||||||
// Disable reset on low voltage
|
// Disable reset on low voltage
|
||||||
void disableBrownOut() {
|
void disableBrownOut() {
|
||||||
|
#ifdef ESP32
|
||||||
REG_CLR_BIT(RTC_CNTL_BROWN_OUT_REG, RTC_CNTL_BROWN_OUT_ENA);
|
REG_CLR_BIT(RTC_CNTL_BROWN_OUT_REG, RTC_CNTL_BROWN_OUT_ENA);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trim and split string by spaces
|
// Trim and split string by spaces
|
||||||
|
|||||||
Reference in New Issue
Block a user