mirror of
https://github.com/okalachev/flix.git
synced 2026-01-09 12:36:49 +00:00
Compare commits
4 Commits
0547ea548b
...
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
|
||||
- name: Check c_cpp_properties.json
|
||||
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:
|
||||
runs-on: macos-latest
|
||||
|
||||
@@ -25,13 +25,15 @@ const int MOTOR_FRONT_LEFT = 3;
|
||||
|
||||
void setupMotors() {
|
||||
print("Setup Motors\n");
|
||||
|
||||
// configure pins
|
||||
#ifdef ESP32
|
||||
ledcAttach(MOTOR_0_PIN, PWM_FREQUENCY, PWM_RESOLUTION);
|
||||
ledcAttach(MOTOR_1_PIN, PWM_FREQUENCY, PWM_RESOLUTION);
|
||||
ledcAttach(MOTOR_2_PIN, PWM_FREQUENCY, PWM_RESOLUTION);
|
||||
ledcAttach(MOTOR_3_PIN, PWM_FREQUENCY, PWM_RESOLUTION);
|
||||
|
||||
#else
|
||||
analogWriteResolution(PWM_RESOLUTION);
|
||||
analogWriteFrequency(PWM_FREQUENCY);
|
||||
#endif
|
||||
sendMotors();
|
||||
print("Motors initialized\n");
|
||||
}
|
||||
@@ -45,10 +47,10 @@ int getDutyCycle(float value) {
|
||||
}
|
||||
|
||||
void sendMotors() {
|
||||
ledcWrite(MOTOR_0_PIN, getDutyCycle(motors[0]));
|
||||
ledcWrite(MOTOR_1_PIN, getDutyCycle(motors[1]));
|
||||
ledcWrite(MOTOR_2_PIN, getDutyCycle(motors[2]));
|
||||
ledcWrite(MOTOR_3_PIN, getDutyCycle(motors[3]));
|
||||
analogWrite(MOTOR_0_PIN, getDutyCycle(motors[0]));
|
||||
analogWrite(MOTOR_1_PIN, getDutyCycle(motors[1]));
|
||||
analogWrite(MOTOR_2_PIN, getDutyCycle(motors[2]));
|
||||
analogWrite(MOTOR_3_PIN, getDutyCycle(motors[3]));
|
||||
}
|
||||
|
||||
bool motorsActive() {
|
||||
|
||||
@@ -6,8 +6,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <math.h>
|
||||
#ifdef ESP32
|
||||
#include <soc/soc.h>
|
||||
#include <soc/rtc_cntl_reg.h>
|
||||
#endif
|
||||
|
||||
const float ONE_G = 9.80665;
|
||||
extern float t;
|
||||
@@ -37,7 +39,9 @@ float wrapAngle(float angle) {
|
||||
|
||||
// Disable reset on low voltage
|
||||
void disableBrownOut() {
|
||||
#ifdef ESP32
|
||||
REG_CLR_BIT(RTC_CNTL_BROWN_OUT_REG, RTC_CNTL_BROWN_OUT_ENA);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Trim and split string by spaces
|
||||
|
||||
Reference in New Issue
Block a user