0.3.4 HeartBeat

This commit is contained in:
Rob Tillaart 2024-09-10 10:18:56 +02:00
parent f4b74b6d23
commit a29a63ec8b
9 changed files with 65 additions and 14 deletions

View File

@ -6,12 +6,16 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/). and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.3.4] - 2024-09-09
- Fix #12, add **bool codeCompleted()** to HeartBeatDiag and HeartBeatSL
- update readme.md
- update keywords.txt
## [0.3.3] - 2022-11-09 ## [0.3.3] - 2022-11-09
- update readme.md - update readme.md
- fix version in .cpp - fix version in .cpp
- update keywords.txt - update keywords.txt
## [0.3.2] - 2022-11-09 ## [0.3.2] - 2022-11-09
- add changelog.md - add changelog.md
- add rp2040 to build-CI - add rp2040 to build-CI

View File

@ -1,7 +1,7 @@
// //
// FILE: HeartBeat.cpp // FILE: HeartBeat.cpp
// AUTHOR: Rob Tillaart // AUTHOR: Rob Tillaart
// VERSION: 0.3.3 // VERSION: 0.3.4
// PURPOSE: Arduino library for HeartBeat with frequency and dutyCycle // PURPOSE: Arduino library for HeartBeat with frequency and dutyCycle
// DATE: 2019-06-12 // DATE: 2019-06-12
// URL: https://github.com/RobTillaart/HeartBeat // URL: https://github.com/RobTillaart/HeartBeat
@ -184,6 +184,13 @@ void HeartBeatDiag::codeOff()
} }
bool HeartBeatDiag::codeCompleted()
{
if (_codeMask > 0) return false;
return true;
}
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// HEARTBEATSL // HEARTBEATSL
@ -271,5 +278,12 @@ void HeartBeatSL::codeOff()
} }
bool HeartBeatSL::codeCompleted()
{
if (_codeMask > 0) return false;
return true;
}
// -- END OF FILE -- // -- END OF FILE --

View File

@ -2,7 +2,7 @@
// //
// FILE: HeartBeat.h // FILE: HeartBeat.h
// AUTHOR: Rob Tillaart // AUTHOR: Rob Tillaart
// VERSION: 0.3.3 // VERSION: 0.3.4
// PURPOSE: Arduino library for HeartBeat with frequency and dutyCycle // PURPOSE: Arduino library for HeartBeat with frequency and dutyCycle
// DATE: 2019-06-12 // DATE: 2019-06-12
// URL: https://github.com/RobTillaart/HeartBeat // URL: https://github.com/RobTillaart/HeartBeat
@ -10,7 +10,7 @@
#include "Arduino.h" #include "Arduino.h"
#define HEARTBEAT_LIB_VERSION (F("0.3.3")) #define HEARTBEAT_LIB_VERSION (F("0.3.4"))
class HeartBeat class HeartBeat
@ -70,9 +70,9 @@ public:
// CONFIGURATION PATTERN // CONFIGURATION PATTERN
// pattern = up to 9 digits, indicating the relative length of the pulses // pattern = up to 9 digits, indicating the relative length of the pulses
// of the error or diagnostic code // of the error or diagnostic code
bool code(uint32_t pattern); // executes ONE time bool code(uint32_t pattern); // executes ONE time
void codeOff(); // explicit stop. void codeOff(); // explicit stop.
bool codeCompleted(); // pattern has been executed.
protected: protected:
uint32_t _code = 0; // up to 9 digits uint32_t _code = 0; // up to 9 digits
@ -101,7 +101,7 @@ public:
// L is a pulse of 3 units, S is a pulse of 1 unit. // L is a pulse of 3 units, S is a pulse of 1 unit.
bool code(const char * str); // executes ONE time bool code(const char * str); // executes ONE time
void codeOff(); // explicit stop. void codeOff(); // explicit stop.
bool codeCompleted(); // pattern has been executed.
protected: protected:
uint8_t _code = 0; // up to 7 bits uint8_t _code = 0; // up to 7 bits

View File

@ -78,6 +78,11 @@ HeartBeatDiag uses more RAM and PROGMEM than HeartBeatSL.
For more complex patterns, please check my pulsePattern library. For more complex patterns, please check my pulsePattern library.
### Related
- https://github.com/RobTillaart/pulsePattern
## Interface ## Interface
```cpp ```cpp
@ -123,8 +128,9 @@ The interface of **HeartBeatSL** adds of the following functions to **HeartBeat*
- **HeartBeatSL()** constructor. - **HeartBeatSL()** constructor.
- **bool code(const char \* str)** executes the pattern ONE time. - **bool code(const char \* str)** executes the pattern ONE time.
Repeating the pattern means repeating the call. Repeating the pattern means repeating the call.
The max supported string length is **7**. The max supported string length is **7** as pattern is stored in a byte.
- **void codeOff()** explicitly stops the pattern. Forced stop. - **void codeOff()** explicitly stops the pattern. Forced stop.
- **bool codeCompleted()** returns true if pattern is executed completely.
Minimal example Minimal example
@ -171,6 +177,7 @@ The interface of **HeartBeatDiag** adds of the following functions:
Repeating the pattern means repeating the call. Repeating the pattern means repeating the call.
The max supported pattern length is **9**. The max supported pattern length is **9**.
- **void codeOff()** explicitly stops the pattern. Forced stop. - **void codeOff()** explicitly stops the pattern. Forced stop.
- **bool codeCompleted()** returns true if pattern is executed completely.
Minimal example Minimal example
@ -242,6 +249,8 @@ See examples
- investigate a pattern recognizer (fun) - investigate a pattern recognizer (fun)
- e.g. with an LDR or lux sensor. - e.g. with an LDR or lux sensor.
- HeartBeatSL
- extend code length to 16 (bit)?
#### Wont #### Wont

View File

@ -39,6 +39,8 @@ void loop()
if (millis() > 3000) HB.code(1369631); if (millis() > 3000) HB.code(1369631);
if (millis() > 20000) HB.codeOff(); if (millis() > 20000) HB.codeOff();
if (millis() > 30000) HB.enable(); if (millis() > 30000) HB.enable();
Serial.println(HB.codeCompleted());
delay(200);
} }

View File

@ -22,7 +22,7 @@ getState KEYWORD2
# Methods from derived class # Methods from derived class
code KEYWORD2 code KEYWORD2
codeOff KEYWORD2 codeOff KEYWORD2
codeCompleted KEYWORD2
# Constants (LITERAL1) # Constants (LITERAL1)
HEARTBEAT_LIB_VERSION LITERAL1 HEARTBEAT_LIB_VERSION LITERAL1

View File

@ -15,7 +15,7 @@
"type": "git", "type": "git",
"url": "https://github.com/RobTillaart/HeartBeat.git" "url": "https://github.com/RobTillaart/HeartBeat.git"
}, },
"version": "0.3.3", "version": "0.3.4",
"license": "MIT", "license": "MIT",
"frameworks": "*", "frameworks": "*",
"platforms": "*", "platforms": "*",

View File

@ -1,5 +1,5 @@
name=HeartBeat name=HeartBeat
version=0.3.3 version=0.3.4
author=Rob Tillaart <rob.tillaart@gmail.com> author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com> maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library for HeartBeat with frequency and duty cycle. sentence=Arduino library for HeartBeat with frequency and duty cycle.

View File

@ -39,7 +39,7 @@
unittest_setup() unittest_setup()
{ {
fprintf(stderr, "VERSION: %s\n", (char *) HEARTBEAT_LIB_VERSION ); fprintf(stderr, "HEARTBEAT_LIB_VERSION: %s\n", (char *) HEARTBEAT_LIB_VERSION );
} }
@ -105,6 +105,28 @@ unittest(test_dutycycle)
} }
unittest(test_HBDIAG)
{
HeartBeatDiag HBD;
HBD.begin(13, 1);
// verify default value
assertTrue(HBD.codeCompleted());
}
unittest(test_HBSL)
{
HeartBeatSL HBD;
HBD.begin(13, 1);
// verify default value
assertTrue(HBD.codeCompleted());
}
unittest_main() unittest_main()
// --------
// -- END OF FILE --