mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-07-27 19:57:38 +00:00
[AS3935MI] Update to 1.3.5 with PRs from ESPEasy changes merged to lib
This commit is contained in:
+19
-5
@@ -8,16 +8,30 @@ sensor: https://ams.com/as3935
|
||||
- Automatic antenna tuning
|
||||
|
||||
## Changelog:
|
||||
- 1.3.5
|
||||
- fixed #50
|
||||
- implemented a more robust, interrupt based calibration procedure that is also faster. thanks to @td-er for reporting and impementing this.
|
||||
- updated increase / decrease function signatures (should be backwards compatible)
|
||||
- updated examples
|
||||
|
||||
- 1.3.4
|
||||
- partially fixed https://bitbucket.org/christandlg/as3935mi/issues/50/resonance-frequency-calibration-inaccurate : fixed a bug where occasionally I2C comms will silently fail during oscillator calibration - thanks to @td-er for reporting and fixing this issue
|
||||
|
||||
- 1.3.3
|
||||
fixed https://bitbucket.org/christandlg/as3935mi/issues/49/class-spiclass-has-no-member-named
|
||||
- fixed https://bitbucket.org/christandlg/as3935mi/issues/49/class-spiclass-has-no-member-named
|
||||
|
||||
- 1.3.2
|
||||
fixed https://bitbucket.org/christandlg/as3935mi/issues/47/need-help-using-as3935spiclass
|
||||
- fixed https://bitbucket.org/christandlg/as3935mi/issues/47/need-help-using-as3935spiclass
|
||||
|
||||
- 1.3.1
|
||||
fixed https://bitbucket.org/christandlg/as3935mi/issues/48/clear-statistics-function-to-be-added
|
||||
- fixed https://bitbucket.org/christandlg/as3935mi/issues/48/clear-statistics-function-to-be-added
|
||||
|
||||
- 1.3.0
|
||||
fixed https://bitbucket.org/christandlg/as3935mi/issues/12/autocalibrate-no-longer-working
|
||||
- fixed https://bitbucket.org/christandlg/as3935mi/issues/12/autocalibrate-no-longer-working
|
||||
|
||||
- 1.2.1
|
||||
Merged PR by Hernán Freschi https://bitbucket.org/christandlg/as3935mi/pull-requests/2
|
||||
- Merged PR by Hernán Freschi https://bitbucket.org/christandlg/as3935mi/pull-requests/2
|
||||
|
||||
- 1.2.0
|
||||
- extended examples to include increasing sensitivity if no disturbances are detected.
|
||||
|
||||
|
||||
+9
-9
@@ -159,10 +159,10 @@ void loop() {
|
||||
//if the noise floor threshold setting is not yet maxed out, increase the setting.
|
||||
//note that noise floor threshold events can also be triggered by an incorrect
|
||||
//analog front end setting.
|
||||
if (as3935.increaseNoiseFloorThreshold())
|
||||
Serial.println("increased noise floor threshold");
|
||||
else
|
||||
if (as3935.increaseNoiseFloorThreshold() == AS3935MI::AS3935_NFL_0)
|
||||
Serial.println("noise floor threshold already at maximum");
|
||||
else
|
||||
Serial.println("increased noise floor threshold");
|
||||
}
|
||||
|
||||
//send a report if a disturber was detected. if disturbers are masked with as3935.writeMaskDisturbers(true);
|
||||
@@ -183,17 +183,17 @@ void loop() {
|
||||
//alternatively increase spike rejection and watchdog threshold
|
||||
if (srej < wdth)
|
||||
{
|
||||
if (as3935.increaseSpikeRejection())
|
||||
Serial.println("increased spike rejection ratio");
|
||||
else
|
||||
if (as3935.increaseSpikeRejection() == AS3935MI::AS3935_SREJ_0)
|
||||
Serial.println("spike rejection ratio already at maximum");
|
||||
else
|
||||
Serial.println("increased spike rejection ratio");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (as3935.increaseWatchdogThreshold())
|
||||
Serial.println("increased watchdog threshold");
|
||||
else
|
||||
if (as3935.increaseWatchdogThreshold() == AS3935MI::AS3935_WDTH_0)
|
||||
Serial.println("watchdog threshold already at maximum");
|
||||
else
|
||||
Serial.println("increased watchdog threshold");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
+9
-9
@@ -146,10 +146,10 @@ void loop() {
|
||||
//if the noise floor threshold setting is not yet maxed out, increase the setting.
|
||||
//note that noise floor threshold events can also be triggered by an incorrect
|
||||
//analog front end setting.
|
||||
if (as3935.increaseNoiseFloorThreshold())
|
||||
Serial.println("increased noise floor threshold");
|
||||
else
|
||||
if (as3935.increaseNoiseFloorThreshold() == AS3935MI::AS3935_NFL_0)
|
||||
Serial.println("noise floor threshold already at maximum");
|
||||
else
|
||||
Serial.println("increased noise floor threshold");
|
||||
}
|
||||
|
||||
//send a report if a disturber was detected. if disturbers are masked with as3935.writeMaskDisturbers(true);
|
||||
@@ -170,17 +170,17 @@ void loop() {
|
||||
//alternatively increase spike rejection and watchdog threshold
|
||||
if (srej < wdth)
|
||||
{
|
||||
if (as3935.increaseSpikeRejection())
|
||||
Serial.println("increased spike rejection ratio");
|
||||
else
|
||||
if (as3935.increaseSpikeRejection() == AS3935MI::AS3935_SREJ_0)
|
||||
Serial.println("spike rejection ratio already at maximum");
|
||||
else
|
||||
Serial.println("increased spike rejection ratio");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (as3935.increaseWatchdogThreshold())
|
||||
Serial.println("increased watchdog threshold");
|
||||
else
|
||||
if (as3935.increaseWatchdogThreshold() == AS3935MI::AS3935_WDTH_0)
|
||||
Serial.println("watchdog threshold already at maximum");
|
||||
else
|
||||
Serial.println("increased watchdog threshold");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
+9
-9
@@ -148,10 +148,10 @@ void loop() {
|
||||
//if the noise floor threshold setting is not yet maxed out, increase the setting.
|
||||
//note that noise floor threshold events can also be triggered by an incorrect
|
||||
//analog front end setting.
|
||||
if (as3935.increaseNoiseFloorThreshold())
|
||||
Serial.println("increased noise floor threshold");
|
||||
else
|
||||
if (as3935.increaseNoiseFloorThreshold() == AS3935MI::AS3935_NFL_0)
|
||||
Serial.println("noise floor threshold already at maximum");
|
||||
else
|
||||
Serial.println("increased noise floor threshold");
|
||||
}
|
||||
|
||||
//send a report if a disturber was detected. if disturbers are masked with as3935.writeMaskDisturbers(true);
|
||||
@@ -172,17 +172,17 @@ void loop() {
|
||||
//alternatively increase spike rejection and watchdog threshold
|
||||
if (srej < wdth)
|
||||
{
|
||||
if (as3935.increaseSpikeRejection())
|
||||
Serial.println("increased spike rejection ratio");
|
||||
else
|
||||
if (as3935.increaseSpikeRejection() == AS3935MI::AS3935_SREJ_0)
|
||||
Serial.println("spike rejection ratio already at maximum");
|
||||
else
|
||||
Serial.println("increased spike rejection ratio");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (as3935.increaseWatchdogThreshold())
|
||||
Serial.println("increased watchdog threshold");
|
||||
else
|
||||
if (as3935.increaseWatchdogThreshold() == AS3935MI::AS3935_WDTH_0)
|
||||
Serial.println("watchdog threshold already at maximum");
|
||||
else
|
||||
Serial.println("increased watchdog threshold");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
+9
-9
@@ -145,10 +145,10 @@ void loop() {
|
||||
//if the noise floor threshold setting is not yet maxed out, increase the setting.
|
||||
//note that noise floor threshold events can also be triggered by an incorrect
|
||||
//analog front end setting.
|
||||
if (as3935.increaseNoiseFloorThreshold())
|
||||
Serial.println("increased noise floor threshold");
|
||||
else
|
||||
if (as3935.increaseNoiseFloorThreshold() == AS3935MI::AS3935_NFL_0)
|
||||
Serial.println("noise floor threshold already at maximum");
|
||||
else
|
||||
Serial.println("increased noise floor threshold");
|
||||
}
|
||||
|
||||
//send a report if a disturber was detected. if disturbers are masked with as3935.writeMaskDisturbers(true);
|
||||
@@ -169,17 +169,17 @@ void loop() {
|
||||
//alternatively increase spike rejection and watchdog threshold
|
||||
if (srej < wdth)
|
||||
{
|
||||
if (as3935.increaseSpikeRejection())
|
||||
Serial.println("increased spike rejection ratio");
|
||||
else
|
||||
if (as3935.increaseSpikeRejection() == AS3935MI::AS3935_SREJ_0)
|
||||
Serial.println("spike rejection ratio already at maximum");
|
||||
else
|
||||
Serial.println("increased spike rejection ratio");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (as3935.increaseWatchdogThreshold())
|
||||
Serial.println("increased watchdog threshold");
|
||||
else
|
||||
if (as3935.increaseWatchdogThreshold() == AS3935MI::AS3935_WDTH_0)
|
||||
Serial.println("watchdog threshold already at maximum");
|
||||
else
|
||||
Serial.println("increased watchdog threshold");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
+9
-9
@@ -222,10 +222,10 @@ void loop() {
|
||||
//if the noise floor threshold setting is not yet maxed out, increase the setting.
|
||||
//note that noise floor threshold events can also be triggered by an incorrect
|
||||
//analog front end setting.
|
||||
if (as3935.increaseNoiseFloorThreshold())
|
||||
Serial.println("increased noise floor threshold");
|
||||
else
|
||||
if (as3935.increaseNoiseFloorThreshold() == AS3935MI::AS3935_NFL_0)
|
||||
Serial.println("noise floor threshold already at maximum");
|
||||
else
|
||||
Serial.println("increased noise floor threshold");
|
||||
}
|
||||
|
||||
//send a report if a disturber was detected. if disturbers are masked with as3935.writeMaskDisturbers(true);
|
||||
@@ -246,17 +246,17 @@ void loop() {
|
||||
//alternatively increase spike rejection and watchdog threshold
|
||||
if (srej < wdth)
|
||||
{
|
||||
if (as3935.increaseSpikeRejection())
|
||||
Serial.println("increased spike rejection ratio");
|
||||
else
|
||||
if (as3935.increaseSpikeRejection() == AS3935MI::AS3935_SREJ_0)
|
||||
Serial.println("spike rejection ratio already at maximum");
|
||||
else
|
||||
Serial.println("increased spike rejection ratio");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (as3935.increaseWatchdogThreshold())
|
||||
Serial.println("increased watchdog threshold");
|
||||
else
|
||||
if (as3935.increaseWatchdogThreshold() == AS3935MI::AS3935_WDTH_0)
|
||||
Serial.println("watchdog threshold already at maximum");
|
||||
else
|
||||
Serial.println("increased watchdog threshold");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "AS3935MI",
|
||||
"version": "1.3.3",
|
||||
"version": "1.3.5",
|
||||
"keywords": "AS3935",
|
||||
"description": "A library for the ams AS3935 lightning sensor. The library supports both the SPI (via the SPI Library) and I2C (via the Wire Library) interfaces. Use of other I2C / SPI libraries (e.g. software I2C) is supported by inheritance. ",
|
||||
"authors":
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name=AS3935MI
|
||||
version=1.3.3
|
||||
version=1.3.5
|
||||
author=Gregor Christandl <christandlg@yahoo.com>
|
||||
maintainer=Gregor Christandl <christandlg@yahoo.com>
|
||||
sentence=A library for the Austria Microsystems AS3935 Franklin Lightning Detector, supporting I2C and SPI interfaces.
|
||||
|
||||
@@ -415,12 +415,12 @@ void AS3935MI::clearStatistics()
|
||||
writeRegisterValue(AS3935_REGISTER_CL_STAT, AS3935_MASK_CL_STAT, 1);
|
||||
}
|
||||
|
||||
bool AS3935MI::decreaseNoiseFloorThreshold()
|
||||
uint8_t AS3935MI::decreaseNoiseFloorThreshold()
|
||||
{
|
||||
uint8_t nf_lev = readNoiseFloorThreshold();
|
||||
|
||||
if (nf_lev == AS3935_NFL_0)
|
||||
return false;
|
||||
return AS3935_NFL_7;
|
||||
|
||||
writeNoiseFloorThreshold(--nf_lev);
|
||||
|
||||
@@ -432,59 +432,59 @@ uint8_t AS3935MI::increaseNoiseFloorThreshold()
|
||||
uint8_t nf_lev = readNoiseFloorThreshold();
|
||||
|
||||
if (nf_lev >= AS3935_NFL_7)
|
||||
return 0;
|
||||
return AS3935_NFL_0;
|
||||
|
||||
writeNoiseFloorThreshold(++nf_lev);
|
||||
|
||||
return nf_lev;
|
||||
}
|
||||
|
||||
bool AS3935MI::decreaseWatchdogThreshold()
|
||||
uint8_t AS3935MI::decreaseWatchdogThreshold()
|
||||
{
|
||||
uint8_t wdth = readWatchdogThreshold();
|
||||
|
||||
if (wdth == AS3935_WDTH_0)
|
||||
return false;
|
||||
return AS3935_WDTH_15;
|
||||
|
||||
writeWatchdogThreshold(--wdth);
|
||||
|
||||
return true;
|
||||
return wdth;
|
||||
}
|
||||
|
||||
bool AS3935MI::increaseWatchdogThreshold()
|
||||
uint8_t AS3935MI::increaseWatchdogThreshold()
|
||||
{
|
||||
uint8_t wdth = readWatchdogThreshold();
|
||||
|
||||
if (wdth >= AS3935_WDTH_15)
|
||||
return false;
|
||||
return AS3935_WDTH_0;
|
||||
|
||||
writeWatchdogThreshold(++wdth);
|
||||
|
||||
return true;
|
||||
return wdth;
|
||||
}
|
||||
|
||||
bool AS3935MI::decreaseSpikeRejection()
|
||||
uint8_t AS3935MI::decreaseSpikeRejection()
|
||||
{
|
||||
uint8_t srej = readSpikeRejection();
|
||||
|
||||
if (srej == AS3935_SREJ_0)
|
||||
return false;
|
||||
return AS3935_SREJ_15;
|
||||
|
||||
writeSpikeRejection(--srej);
|
||||
|
||||
return true;
|
||||
return srej;
|
||||
}
|
||||
|
||||
bool AS3935MI::increaseSpikeRejection()
|
||||
uint8_t AS3935MI::increaseSpikeRejection()
|
||||
{
|
||||
uint8_t srej = readSpikeRejection();
|
||||
|
||||
if (srej >= AS3935_SREJ_15)
|
||||
return false;
|
||||
return AS3935_SREJ_0;
|
||||
|
||||
writeSpikeRejection(++srej);
|
||||
|
||||
return true;
|
||||
return srej;
|
||||
}
|
||||
|
||||
void AS3935MI::displayLcoOnIrq(bool enable)
|
||||
|
||||
@@ -303,7 +303,7 @@ public:
|
||||
/*
|
||||
increases the noise floor threshold setting, if possible.
|
||||
@return true on success, false otherwise. */
|
||||
bool decreaseNoiseFloorThreshold();
|
||||
uint8_t decreaseNoiseFloorThreshold();
|
||||
|
||||
/*
|
||||
increases the noise floor threshold setting, if possible.
|
||||
@@ -313,22 +313,22 @@ public:
|
||||
/*
|
||||
increases the watchdog threshold setting, if possible.
|
||||
@return true on success, false otherwise. */
|
||||
bool decreaseWatchdogThreshold();
|
||||
uint8_t decreaseWatchdogThreshold();
|
||||
|
||||
/*
|
||||
increases the watchdog threshold setting, if possible.
|
||||
@return true on success, false otherwise. */
|
||||
bool increaseWatchdogThreshold();
|
||||
uint8_t increaseWatchdogThreshold();
|
||||
|
||||
/*
|
||||
increases the spike rejection setting, if possible.
|
||||
@return true on success, false otherwise. */
|
||||
bool decreaseSpikeRejection();
|
||||
uint8_t decreaseSpikeRejection();
|
||||
|
||||
/*
|
||||
increases the spike rejection setting, if possible.
|
||||
@return true on success, false otherwise. */
|
||||
bool increaseSpikeRejection();
|
||||
uint8_t increaseSpikeRejection();
|
||||
|
||||
// Ideally 500 kHz signal divided by the set division ratio
|
||||
void displayLcoOnIrq(bool enable);
|
||||
|
||||
Reference in New Issue
Block a user