master v0.0.2
IoTcat 5 years ago
parent 36c19c1a95
commit 0581f5dbba
  1. 15
      src/digital-clock.ino
  2. 4
      src/digital-screen.h
  3. 2
      src/ovo.h
  4. 20
      src/switch.h

@ -5,8 +5,8 @@
* @category digital-clock
* @package digital-clock.ino
* @copyright Copyright (c) 2019 IoTcat (https://iotcat.me)
* @license GNU General Public License 2.0
* @version 0.0.1
* @license GNU General Public License 3.0
* @version 0.0.2
*/
@ -18,6 +18,12 @@
//去掉下一行的注释以开启debug模式
//#define DEBUG_MODE
/*** 是否使用备用开关算法 ****/
//!!仅在暂停键不灵敏时考虑本选项!!
//去掉下一行的注释以使用备用开关算法
//#define FORCED_SWITCH
/*** 定义初始参数 ****/
@ -25,9 +31,12 @@
#define GROUP_ID 22 //计时器增大到此值将重新从零开始
//例如此处我的组号是22
//时钟变换时间间隔 (毫秒)
//时钟变换时间间隔 (毫秒)::如果组号超过30可考虑调小本值
#define INTERVAL_TIME 1000 //默认是1秒
//按下开关后冻结时间 (毫秒)::仅在备用开关模式有效
#define SWI_DELAY_TIME 1200
//pin口 - 接译码器1 (显示个位)
#define DIG_1_1 9 //A
#define DIG_1_2 10 //B

@ -5,8 +5,8 @@
* @category digital-clock
* @package digital-screen.h
* @copyright Copyright (c) 2019 iotcat (https://iotcat.me)
* @license GNU General Public License 2.0
* @version 0.0.1
* @license GNU General Public License 3.0
* @version 0.0.2
*/

@ -5,7 +5,7 @@
* @category ovo-arduino
* @package ovo.cpp
* @copyright Copyright (c) 2019 EEENeko (https://github.com/eeeneko)
* @license GNU General Public License 2.0
* @license GNU General Public License 3.0
* @version 0.0.1
*/

@ -5,8 +5,8 @@
* @category digital-clock
* @package switch.h
* @copyright Copyright (c) 2019 IoTcat (https://iotcat.me)
* @license GNU General Public License 2.0
* @version 0.0.1
* @license GNU General Public License 3.0
* @version 0.0.2
*/
@ -23,6 +23,9 @@
#define SWI_RESET 4
#endif
#ifndef SWI_DELAY_TIME 1200
#define SWI_DELAY_TIME 1200
#endif
class Switch{
@ -77,13 +80,24 @@ private:
static bool s_fIsPressed = false;
set_isPressed();
#ifdef FORCED_SWITCH
static unsigned int t_t = millis();
// 检测开关键按下动作
if(this->_isPressed != s_fIsPressed){
if(t_t < millis() - SWI_DELAY_TIME ){
this->_status = !(this->_status);
t_t = millis();
}
}
#else
// 检测开关键松开动作
if(this->_isPressed != s_fIsPressed /*&& this->_isPressed != _type*/){
this->_status = !(this->_status);
delay(600);
}
#endif
}
};

Loading…
Cancel
Save