Skip to content

Commit

Permalink
Move constants out of PoorManFloat.h
Browse files Browse the repository at this point in the history
  • Loading branch information
gin66 committed Sep 20, 2024
1 parent ed652da commit 1b70ecc
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 14 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ TODO:
- rename RampConstAcceleration to e.g. RampControl
- for esp-idf 5 make use of espressif resource management of rmt channels

pre-0.31.2:
- Move constants out of PoorManFloat.h

0.31.1:
- Fix for issue #280: stopMove() is interrupted if followed by update of speed/acceleration
- Related to issue #280: `isStopping()` did not work as expected and this should be fixed, too.
Expand Down
1 change: 1 addition & 0 deletions extras/tests/pc_based/PMF_test.ino
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <stdint.h>

#include "PoorManFloat.h"
#include "PoorManFloatConst.h"

//
// This file can be renamed to a .ino and compiled as sketch to be run on the
Expand Down
1 change: 1 addition & 0 deletions extras/tests/pc_based/pmf_test.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <stdint.h>

#include "PoorManFloat.h"
#include "PoorManFloatConst.h"

//
// This file can be renamed to a .ino and compiled as sketch to be run on the
Expand Down
15 changes: 1 addition & 14 deletions src/PoorManFloat.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,7 @@
typedef int16_t pmf_logarithmic;

#define PMF_CONST_INVALID ((pmf_logarithmic)0x8000)
#define PMF_CONST_MAX ((pmf_logarithmic)0x7fff)
#define PMF_CONST_1 ((pmf_logarithmic)0x0000)
#define PMF_CONST_3_DIV_2 ((pmf_logarithmic)0x012c)
#define PMF_CONST_128E12 ((pmf_logarithmic)0x5dba)
#define PMF_CONST_16E6 ((pmf_logarithmic)0x2fdd)
#define PMF_CONST_500 ((pmf_logarithmic)0x11ee)
#define PMF_CONST_1000 ((pmf_logarithmic)0x13ee)
#define PMF_CONST_2000 ((pmf_logarithmic)0x15ee)
#define PMF_CONST_32000 ((pmf_logarithmic)0x1dee)
#define PMF_CONST_16E6_DIV_SQRT_OF_2 ((pmf_logarithmic)0x2edd)
#define PMF_CONST_21E6 ((pmf_logarithmic)0x30a5)
#define PMF_CONST_42000 ((pmf_logarithmic)0x1eb7)
#define PMF_CONST_21E6_DIV_SQRT_OF_2 ((pmf_logarithmic)0x2fa5)
#define PMF_CONST_2205E11 ((pmf_logarithmic)0x5f96)

pmf_logarithmic pmfl_from(uint8_t x);
pmf_logarithmic pmfl_from(uint16_t x);
pmf_logarithmic pmfl_from(uint32_t x);
Expand Down
20 changes: 20 additions & 0 deletions src/PoorManFloatConst.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#ifndef POORMANFLOATCONST_H
#define POORMANFLOATCONST_H

#include <PoorManFloat.h>

#define PMF_CONST_MAX ((pmf_logarithmic)0x7fff)
#define PMF_CONST_1 ((pmf_logarithmic)0x0000)
#define PMF_CONST_3_DIV_2 ((pmf_logarithmic)0x012c)
#define PMF_CONST_128E12 ((pmf_logarithmic)0x5dba)
#define PMF_CONST_16E6 ((pmf_logarithmic)0x2fdd)
#define PMF_CONST_500 ((pmf_logarithmic)0x11ee)
#define PMF_CONST_1000 ((pmf_logarithmic)0x13ee)
#define PMF_CONST_2000 ((pmf_logarithmic)0x15ee)
#define PMF_CONST_32000 ((pmf_logarithmic)0x1dee)
#define PMF_CONST_16E6_DIV_SQRT_OF_2 ((pmf_logarithmic)0x2edd)
#define PMF_CONST_21E6 ((pmf_logarithmic)0x30a5)
#define PMF_CONST_42000 ((pmf_logarithmic)0x1eb7)
#define PMF_CONST_21E6_DIV_SQRT_OF_2 ((pmf_logarithmic)0x2fa5)
#define PMF_CONST_2205E11 ((pmf_logarithmic)0x5f96)
#endif
1 change: 1 addition & 0 deletions src/RampCalculator.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <stdint.h>

#include "PoorManFloat.h"
#include "PoorManFloatConst.h"
#include "fas_arch/common.h"

#if (TICKS_PER_S == 16000000L)
Expand Down

0 comments on commit 1b70ecc

Please sign in to comment.