Skip to content

Commit

Permalink
Feature/maxou/ax b formula stepper (#72)
Browse files Browse the repository at this point in the history
* SG1-gate
* make "infinite" gear
* test speed
* Change speed values
* use idf 5.1
  • Loading branch information
pinkymaxou authored Sep 17, 2023
1 parent 6aa3145 commit bafb41d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 23 deletions.
Binary file added Build-Instructions-SG1/led-size.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Build-Instructions-SG1/stepper-size.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM espressif/idf:release-v5.0
FROM espressif/idf:release-v5.1

WORKDIR /app

Expand Down
22 changes: 20 additions & 2 deletions Source/base-fw/main/GateStepper.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static IRAM_ATTR void tmr_signal_callback(void* arg)
if (m_bPeriodAlternate)
{
const int32_t s32 = MIN(abs(m_s32Count) , abs(m_s32Target - m_s32Count));

/* Former code
if (s32 < 50*2)
m_s32Period = 2000/2;
else if (s32 < 100*2)
Expand All @@ -110,7 +110,25 @@ static IRAM_ATTR void tmr_signal_callback(void* arg)
else if (s32 < 700*2)
m_s32Period = 600/2;
else
m_s32Period = 400/2;
m_s32Period = 400/2;*/
/* I just did some tests until I was satisfied */
/* #1 (100, 1000), (1400, 300)
a = -0.53846153846153846153846153846154
b = 1053.84 */
/* #2 (100, 700), (1400, 200)
a = -0.3846
b = 738.44 */
const int32_t a = -461;
const int32_t b = 946840;
m_s32Period = (a * s32 + b)/1000;

// I hoped it would reduce jitter.
m_s32Period = (m_s32Period / 50) * 50;

if (m_s32Period < 200)
m_s32Period = 200;
if (m_s32Period > 700)
m_s32Period = 700;

// Count every two
m_s32Count++;
Expand Down
20 changes: 0 additions & 20 deletions Source/base-fw/main/webserver/EmbeddedFiles.txt

This file was deleted.

0 comments on commit bafb41d

Please sign in to comment.