diff --git a/FanController.cpp b/FanController.cpp index ef3dade..2797fed 100644 --- a/FanController.cpp +++ b/FanController.cpp @@ -5,6 +5,12 @@ #include #endif +#if defined(ESP8266) + #define ISR_PREFIX ICACHE_RAM_ATTR +#else + #define ISR_PREFIX +#endif + FanController::FanController(byte sensorPin, unsigned int sensorThreshold, byte pwmPin) { _sensorPin = sensorPin; @@ -40,8 +46,8 @@ unsigned int FanController::getSpeed() { _halfRevs = 0; _lastMillis = millis(); _attachInterrupt(); - return _lastReading; } + return _lastReading; } void FanController::setDutyCycle(byte dutyCycle) { @@ -93,9 +99,9 @@ void FanController::_triggerCaller(byte instance) } } -void FanController::_triggerExt0() { FanController::_triggerCaller(0); } -void FanController::_triggerExt1() { FanController::_triggerCaller(1); } -void FanController::_triggerExt2() { FanController::_triggerCaller(2); } -void FanController::_triggerExt3() { FanController::_triggerCaller(3); } -void FanController::_triggerExt4() { FanController::_triggerCaller(4); } -void FanController::_triggerExt5() { FanController::_triggerCaller(5); } \ No newline at end of file +ISR_PREFIX void FanController::_triggerExt0() { FanController::_triggerCaller(0); } +ISR_PREFIX void FanController::_triggerExt1() { FanController::_triggerCaller(1); } +ISR_PREFIX void FanController::_triggerExt2() { FanController::_triggerCaller(2); } +ISR_PREFIX void FanController::_triggerExt3() { FanController::_triggerCaller(3); } +ISR_PREFIX void FanController::_triggerExt4() { FanController::_triggerCaller(4); } +ISR_PREFIX void FanController::_triggerExt5() { FanController::_triggerCaller(5); } \ No newline at end of file diff --git a/FanController.h b/FanController.h index 6d7c7c5..44dc3e3 100644 --- a/FanController.h +++ b/FanController.h @@ -20,7 +20,7 @@ class FanController static FanController *_instances[6]; byte _sensorPin; byte _sensorInterruptPin; - byte _sensorThreshold; + unsigned int _sensorThreshold; byte _pwmPin; byte _pwmDutyCycle; byte _instance; diff --git a/library.json b/library.json index 136301f..2a42b3e 100644 --- a/library.json +++ b/library.json @@ -15,7 +15,7 @@ "maintainer": true } ], - "version": "1.0.5", + "version": "1.0.6", "frameworks": "arduino", "platforms": "*" } diff --git a/library.properties b/library.properties index 9155170..78db404 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=FanController -version=1.0.5 +version=1.0.6 author=Giorgio Aresu maintainer=Giorgio Aresu sentence=Arduino Library for controlling PC fans