Skip to content

Commit

Permalink
change library version GyverStepper & add USE_STEPPER_ACCELERATION se…
Browse files Browse the repository at this point in the history
…tting
  • Loading branch information
LKosoj committed Feb 9, 2024
1 parent 4385411 commit e3398e7
Show file tree
Hide file tree
Showing 73 changed files with 6,783 additions and 709 deletions.
2 changes: 1 addition & 1 deletion I2CStepper.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ bool set_stepper_target(uint16_t spd, uint8_t direction, uint32_t target) {
if (spd > 0) {
stepper.setTarget(2147483646);
stepper.setMaxSpeed(spd);
stepper.setSpeed(spd);
//stepper.setSpeed(spd);
startService();
}
return true;
Expand Down
12 changes: 11 additions & 1 deletion Samovar.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,17 @@ LiquidCrystal_I2C lcd(LCD_ADDRESS, LCD_COLUMNS, LCD_ROWS);

Encoder encoder(ENC_CLK, ENC_DT, ENC_SW, TYPE2);

GStepper< STEPPER2WIRE> stepper(STEPPER_STEPS, STEPPER_STEP, STEPPER_DIR, STEPPER_EN);

#define DRIVER_STEP_TIME 4

#ifdef USE_STEPPER_ACCELERATION
#define GS_FAST_PROFILE 10
#else
#define GS_NO_ACCEL
#endif

#include <GyverStepper2.h>
GStepper2< STEPPER2WIRE> stepper(STEPPER_STEPS, STEPPER_STEP, STEPPER_DIR, STEPPER_EN);

iarduino_I2C_connect I2C2;

Expand Down
9 changes: 5 additions & 4 deletions Samovar.ino
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,8 @@
#include <EEPROM.h>
#include <ESPAsyncWiFiManager.h>

#define DRIVER_STEP_TIME 1
#include <GyverEncoder.h>

#include <GyverStepper.h>
#include <GyverButton.h>

#include <GyverPID.h>
Expand Down Expand Up @@ -220,13 +218,14 @@ void stopService(void) {

void startService(void) {
// timerAlarmDisable(timer);
timerAlarmWrite(timer, stepper.stepTime, true);
timerAlarmWrite(timer, stepper.getPeriod(), true);
// timerAlarmWrite(timer, stepper.stepTime, true);
timerAlarmEnable(timer);
}

void ICACHE_RAM_ATTR StepperTicker(void) {
portENTER_CRITICAL_ISR(&timerMux);
StepperMoving = stepper.quicktick();
StepperMoving = stepper.tickManual();
portEXIT_CRITICAL_ISR(&timerMux);
}

Expand Down Expand Up @@ -1028,6 +1027,8 @@ void setup() {
}

void loop() {
//пересчитаем время работы таймера для шагового двигателя
timerAlarmWrite(timer, stepper.getPeriod(), true);

#ifdef USE_UPDATE_OTA
ArduinoOTA.handle();
Expand Down
1 change: 1 addition & 0 deletions Samovar_ini.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ int8_t servoDelta[11] = {0, -2, -3, -4, -3, -2, 0, 0, 0, 0, -2};
//#define USE_PRESSURE_1WIRE {0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x55} //использовать датчик давления по 1Wire
//#define USE_PRESSURE_MPX //использовать датчик давления MPX5010D

//#define USE_STEPPER_ACCELERATION //использовать плавный старт и торможение шагового двигателя
//#define STEPPER_REVERSE //изменить направление врашения шагового двигателя

////#define COLUMN_WETTING //если установлен датчик уровня флегмы, при старте ректификации довести колонну до предзахлеба для смачивания насадки (пока не используется)
Expand Down
2 changes: 1 addition & 1 deletion beer.h
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ void HopStepperStep() {
stepper.brake();
stepper.disable();
stepper.setMaxSpeed(200); //скорость движения шагового двигателя
stepper.setSpeed(200); //скорость движения шагового двигателя, должна быть равна предыдущей
//stepper.setSpeed(200); //скорость движения шагового двигателя, должна быть равна предыдущей
TargetStepps = 360 / 1.8 * 16 / 20; //16 - множитель на драйвере двигателя. 20 - количество отверстий по целому кругу (если бы они занимали всю окружность)
stepper.setCurrent(0);
stepper.setTarget(TargetStepps);
Expand Down
Loading

0 comments on commit e3398e7

Please sign in to comment.