From 194bc27e2344e588cb1caa4e4b387d2f108901ea Mon Sep 17 00:00:00 2001 From: Softonik Date: Sat, 29 Jun 2024 00:55:43 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D1=80=D0=B5=D0=B6=D0=B8=D0=BC=D1=8B=20=D1=83?= =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D1=8F=D1=8E=D1=89=D0=B5=D0=B3?= =?UTF-8?q?=D0=BE=20=D1=81=D0=B2=D0=B5=D1=82=D0=BE=D0=BC=20=D0=BF=D0=B8?= =?UTF-8?q?=D0=BD=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dvizh.cpp | 2 +- main.go.h | 6 +++--- pkg/app/main.go | 3 +++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dvizh.cpp b/dvizh.cpp index 1ac9f15..420d450 100644 --- a/dvizh.cpp +++ b/dvizh.cpp @@ -34,7 +34,7 @@ void TaskInterruptsReceiver(void*) { void setup_dvizh() { pinMode(DVIZH_VERH_PIN, INPUT); pinMode(DVIZH_NIZ_PIN, INPUT); - pinMode(SVET_ONOFF_PIN, OUTPUT); + pinMode(SVET_ONOFF_PIN, INPUT); pinMode(SVET_YARK_PIN, OUTPUT); initSvet(); diff --git a/main.go.h b/main.go.h index 74296b2..63aa256 100644 --- a/main.go.h +++ b/main.go.h @@ -37,7 +37,7 @@ void Vklyuchit() { } void Vyklyuchit() { Yarkost(MIN_YARKOST); Disable(); -} + void initLED() { ledcSetup(LEDC_CHANNEL_0,LEDC_BASE_FREQ,LEDC_RESOLUTION_BITS); ledcAttachPin(SVET_YARK_PIN,LEDC_CHANNEL_0); } @@ -45,10 +45,10 @@ void Yarkost(unsigned long i) { ledcWrite(LEDC_CHANNEL_0,MAX_CHANNEL_VALUE-i); } void Enable() { - digitalWrite(SVET_ONOFF_PIN,1); + digitalWrite(SVET_ONOFF_PIN,1); pinMode(SVET_ONOFF_PIN,OUTPUT); } void Disable() { - digitalWrite(SVET_ONOFF_PIN,0); + pinMode(SVET_ONOFF_PIN,INPUT); digitalWrite(SVET_ONOFF_PIN,0); } void TaskSveta() { int v; PropustitRaz(); while(1) {v=ulTaskNotifyTake(0,loopBlockTime); if (v>0) { DvizhEst(); } else { DvizhaNet(); }} diff --git a/pkg/app/main.go b/pkg/app/main.go index 84a8562..dfeaa93 100644 --- a/pkg/app/main.go +++ b/pkg/app/main.go @@ -9,6 +9,7 @@ import ( ) const MAX_YARKOST uint32 = 2000 + const MIN_YARKOST uint32 = 500 const VREMYA_VKL int = 2000 @@ -112,8 +113,10 @@ func Yarkost(i uint32) { } func Enable() { digital.Write(SVET_ONOFF_PIN, 1) + digital.PinMode(SVET_ONOFF_PIN, digital.ModeOutput) } func Disable() { + digital.PinMode(SVET_ONOFF_PIN, digital.ModeInput) digital.Write(SVET_ONOFF_PIN, 0) }