Bump version to 0.2.11
This commit is contained in:
parent
73c71be853
commit
f0e6f3b083
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vvzvlad/node-red-contrib-rn-combined-nodes",
|
||||
"version": "0.2.10",
|
||||
"version": "0.2.11",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
|
@ -11,17 +11,15 @@ module.exports = function(RED) {
|
||||
const HEAT_OFF_THRESHOLD = 0.2
|
||||
let debug = ""
|
||||
|
||||
|
||||
context.set("pwm_timer", null);
|
||||
context.set("pwm_period", 30*60*1000);
|
||||
context.set("pwm_tick", 1000);
|
||||
let pwm_timer = null
|
||||
context.set("pwm_period", 10000) //30*60*1000)
|
||||
context.set("pwm_tick", 1000)
|
||||
|
||||
function manage_pwm(duty_cycle_percent) {
|
||||
if (duty_cycle_percent === -1) {
|
||||
const pwm_timer = context.get("pwm_timer");
|
||||
if (pwm_timer !== null) {
|
||||
clearInterval(pwm_timer);
|
||||
context.set("pwm_timer", null);
|
||||
clearInterval(pwm_timer)
|
||||
pwm_timer = null
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -29,11 +27,11 @@ module.exports = function(RED) {
|
||||
const pwm_duty_cycle = Math.max(0, Math.min(1, duty_cycle_percent / 100));
|
||||
context.set("pwm_duty_cycle", pwm_duty_cycle);
|
||||
|
||||
if (context.get("pwm_timer") === null) {
|
||||
if (pwm_timer === null) {
|
||||
let cycle_start_time = Date.now();
|
||||
const pwm_tick = context.get("pwm_tick");
|
||||
|
||||
const pwm_timer = setInterval(() => {
|
||||
pwm_timer = setInterval(() => {
|
||||
const pwm_period = context.get("pwm_period");
|
||||
const elapsed_time = Date.now() - cycle_start_time;
|
||||
const on_time = pwm_period * pwm_duty_cycle;
|
||||
@ -49,8 +47,6 @@ module.exports = function(RED) {
|
||||
}
|
||||
|
||||
}, pwm_tick);
|
||||
|
||||
context.set("pwm_timer", pwm_timer);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user