Firmware Version 1.0.4

This commit is contained in:
0x23 2026-03-13 09:10:45 +01:00
parent 18313cc6ae
commit e13cbda4cc
26 changed files with 794 additions and 256 deletions

View file

@ -1,14 +1,20 @@
#pragma once
#include "utilities/math_constants.h"
// #define DEMO_MODE
//--- MOTORS ------------------------------------------------------------------
// motor pole pair count
// * 100 for 0.9deg stepper motors
// * 50 for 1.8deg stepper motors
constexpr float MOTOR1_POLE_PAIRS = 100;
constexpr float MOTOR2_POLE_PAIRS = 100;
constexpr float MOTOR3_POLE_PAIRS = 100;
constexpr float MOTOR1_POLE_PAIRS = 50;
constexpr float MOTOR2_POLE_PAIRS = 50;
constexpr float MOTOR3_POLE_PAIRS = 50;
// max current factor in range [0..1]. Lower values reduce pwm resolution so a
// value above 0.4 is recommended.
constexpr float MOTOR_MAX_CURRENT_FACTOR = 0.6f;
//--- ENCODERS ----------------------------------------------------------------
@ -28,18 +34,44 @@ constexpr float HOMING_FINISH_POS = 0.5f; // in rad
//--- CALIBRATION -------------------------------------------------------------
// degrees from home position
constexpr float CALIBRATION_RANGE = 95;
constexpr float CALIBRATION_RANGE = 83;
// velocity of the magnetic field during calibration (lower is more accurate)
constexpr float CALIBRATION_FIELD_VELOCITY = 40.0f;
constexpr float CALIBRATION_FIELD_VELOCITY = 20.0f;
// size of the calibration lookup table
constexpr int ENCODER_LUT_SIZE = 256;
//--- CLOSED LOOP CONTROL -----------------------------------------------------
// position controller
constexpr float POS_KP = 60.0f;
constexpr float POS_KI = 30000.0f;
// velocity controller
constexpr float VEL_LOWPASS_TC = 0.004f;
constexpr float VEL_KP = 0.2f;
constexpr float VEL_KI = 90.0f;
//--- KINEMATIC ---------------------------------------------------------------
// Kinematic Parameters are defined kinematic_modes/kinematic_model_delta3d.cpp
// NUM_JOINTS and NUM_TOOLS are defined in 'path_segment.h'. Note that changing
// the number of joints requires changing the kinematic model accordingly and
// also requires the initialization of the correct number of 'RobotJoint' objects
// in the Robtos init method.
//--- PINS --------------------------------------------------------------------
#define JOINT_READY_OVERRIDE
// #define SINGLE_AXIS_BOARD
#ifndef SINGLE_AXIS_BOARD
// Pins for 3Axis Board
#define PIN_BUILTIN_LED 23
#define PIN_USER_BUTTON 24
// #define PIN_BUILTIN_LED 23 // RP2040 pico clone
// #define PIN_USER_BUTTON 24 // RP2040 pico clone
#define PIN_BUILTIN_LED 25
#define PIN_M1_PWM_A_POS 13
#define PIN_M1_PWM_A_NEG 12
@ -67,6 +99,9 @@ constexpr float CALIBRATION_FIELD_VELOCITY = 40.0f;
#define PIN_ENCODER_MISO 0
#define PIN_ENCODER_MOSI 3
#define PIN_TOOL1 16
#define PIN_TOOL2 17
#else
// Single Axis Board
#define PIN_BUILTIN_LED 16