Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/arduino-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: arduino/arduino-lint-action@v1
- uses: actions/checkout@v6
- uses: arduino/arduino-lint-action@v2
with:
library-manager: update
compliance: strict
3 changes: 1 addition & 2 deletions .github/workflows/arduino_test_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ jobs:
runTest:
runs-on: ubuntu-latest
timeout-minutes: 20

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/jsoncheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ on:
paths:
- '**.json'
pull_request:
paths:
- '**.json'

jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: json-syntax-check
uses: limitusus/json-syntax-check@v2
with:
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).


## [0.4.3] - 2026-01-02
- update GitHub actions
- update examples
- minor edits

## [0.4.2] - 2024-02-02
- update readme.md
- a.o. rewrite description, future section.
- minor refactor examples
- minor edits


## [0.4.1] - 2023-10-30
- update readme.md (badges).
- add performance test example (another).
Expand Down
2 changes: 1 addition & 1 deletion FastMap.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// FILE: FastMap.cpp
// AUTHOR: Rob Tillaart
// VERSION: 0.4.2
// VERSION: 0.4.3
// PURPOSE: class with fast map function - library for Arduino
// URL: https://github.com/RobTillaart/FastMap

Expand Down
4 changes: 2 additions & 2 deletions FastMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
//
// FILE: FastMap.h
// AUTHOR: Rob Tillaart
// VERSION: 0.4.2
// VERSION: 0.4.3
// PURPOSE: class with fast map function - library for Arduino
// URL: https://github.com/RobTillaart/FastMap


#include "Arduino.h"

#define FASTMAP_LIB_VERSION (F("0.4.2"))
#define FASTMAP_LIB_VERSION (F("0.4.3"))


class FastMap
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2010-2024 Rob Tillaart
Copyright (c) 2010-2026 Rob Tillaart

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ This is to prevent NaN errors and **init()** will return false if such range is

If the **init()** function is not called a 1 to 1 mapping is used.

#### Related
Feedback as always is welcome.

### Related

Other mapping libraries

Expand All @@ -56,6 +58,9 @@ Other mapping libraries
- https://github.com/RobTillaart/moduloMap
- https://github.com/RobTillaart/MultiMap

Additional fast mapping investigated by brewmanz can be found here:
- https://github.com/RobTillaart/FastMap/pull/9


## Performance notes

Expand Down Expand Up @@ -92,7 +97,7 @@ Furthermore using double might imply a performance penalty on some platforms.
#include "FastMap.h"
```

#### Base
### Base

- **FastMap()** Constructor
- **bool init(float in_min, float in_max, float out_min, float out_max)** defines the linear mapping parameters.
Expand All @@ -106,7 +111,7 @@ If **init()** is not called the default is 1 to 1 mapping.
- **float back(float value)** does the inverse mapping.


#### Constrains
### Constrains

FastMap supports three versions of constraining the map function, based upon the parameters of **init()**.

Expand All @@ -130,7 +135,7 @@ Note that on most embedded platforms the performance of doubles is less than flo
See below.


#### boards supporting double
### boards supporting double

| board | float | double |
|:---------------|:-------:|:--------:|
Expand Down Expand Up @@ -198,14 +203,16 @@ FM.init(in_min, in_max, 0.0, 100.0);

#### Should

- investigate exponential mapping: ```x -> alpha * beta^x```??
- gamma mapping, some curve from A->B


#### Could

- investigate map function for 64 bit integers.
- investigate map function for complex numbers? / coordinates?
- what does linear interpolation mean, map an input area upon an output area?
- Template class?
- investigate exponential mapping: ```x -> alpha * beta^x```??
- do we need **constrainedBack()**? in three versions?

#### Wont
Expand Down
1 change: 1 addition & 0 deletions examples/constrainedMapDemo/constrainedMapDemo.ino
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ FastMap mapper;
void setup()
{
Serial.begin(115200);
Serial.println();
Serial.println(__FILE__);
Serial.print("FASTMAP_LIB_VERSION: ");
Serial.println(FASTMAP_LIB_VERSION);
Expand Down
1 change: 1 addition & 0 deletions examples/fastMapDemo/fastMapDemo.ino
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ FastMap mapper;
void setup()
{
Serial.begin(115200);
Serial.println();
Serial.println(__FILE__);
Serial.print("FASTMAP_LIB_VERSION: ");
Serial.println(FASTMAP_LIB_VERSION);
Expand Down
1 change: 1 addition & 0 deletions examples/fastMapDemo2/fastMapDemo2.ino
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ FastMap FtoC; // Fahrenheit to Celsius
void setup()
{
Serial.begin(115200);
Serial.println();
Serial.println(__FILE__);
Serial.print("FASTMAP_LIB_VERSION: ");
Serial.println(FASTMAP_LIB_VERSION);
Expand Down
1 change: 1 addition & 0 deletions examples/fastMapDemo3/fastMapDemo3.ino
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ FastMap CtoF; // Celsius to Fahrenheit
void setup()
{
Serial.begin(115200);
Serial.println();
Serial.println(__FILE__);
Serial.print("FASTMAP_LIB_VERSION: ");
Serial.println(FASTMAP_LIB_VERSION);
Expand Down
1 change: 1 addition & 0 deletions examples/fastMapDemo4/fastMapDemo4.ino
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ FastMap mapper;
void setup()
{
Serial.begin(115200);
Serial.println();
Serial.println(__FILE__);
Serial.print("FASTMAP_LIB_VERSION: ");
Serial.println(FASTMAP_LIB_VERSION);
Expand Down
1 change: 1 addition & 0 deletions examples/fastMapDouble/fastMapDouble.ino
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ FastMapDouble mapper;
void setup()
{
Serial.begin(115200);
Serial.println();
Serial.println(__FILE__);
Serial.print("FASTMAP_LIB_VERSION: ");
Serial.println(FASTMAP_LIB_VERSION);
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/FastMap"
},
"version": "0.4.2",
"version": "0.4.3",
"license": "MIT",
"frameworks": "*",
"platforms": "*",
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=FastMap
version=0.4.2
version=0.4.3
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Library with fast map function for Arduino.
Expand Down