Добавлен новый режим работы бракиратора 1908141216
This commit is contained in:
parent
00f8e7bdcf
commit
7a5e1ea8e7
|
|
@ -5,7 +5,7 @@ src_lib_ver=2_01_00
|
|||
name=KSM-Line-2.0
|
||||
output=KSM-Line-2.0.tpc
|
||||
debug=off
|
||||
defines= /dLCD_TYPE=SOLOMON_SSD1963 /dOBJECT_LCD=LCD_ENABLED /dOBJECT_FD=FD_ENABLED /dOBJECT_KP=KP_ENABLED /dOBJECT_WLN=WLN_ENABLED
|
||||
defines=/dLCD_TYPE=SOLOMON_SSD1963 /dOBJECT_LCD=LCD_ENABLED /dOBJECT_FD=FD_ENABLED /dOBJECT_KP=KP_ENABLED /dOBJECT_WLN=WLN_ENABLED
|
||||
transport=udp_broadcast
|
||||
[address1]
|
||||
platform=SIMULATOR
|
||||
|
|
|
|||
35
braker.tc
35
braker.tc
|
|
@ -28,9 +28,11 @@ void brakers_init(){
|
|||
if (config.BRAKERS[num].Enable){
|
||||
config.STORE_BRAKER = true;
|
||||
#if PLATFORM_ID != SIMULATOR
|
||||
braker_add_port(config.BRAKERS[num].SensPort);
|
||||
io.num = INPIN[config.BRAKERS[num].SensPort-1];
|
||||
io.enabled=false;
|
||||
if (config.BRAKERS[num].SensPort>0){
|
||||
braker_add_port(config.BRAKERS[num].SensPort);
|
||||
io.num = INPIN[config.BRAKERS[num].SensPort-1];
|
||||
io.enabled=false;
|
||||
}
|
||||
if (config.BRAKERS[num].DropPort >0){
|
||||
braker_add_port(config.BRAKERS[num].DropPort);
|
||||
io.num = INPIN[config.BRAKERS[num].DropPort-1];
|
||||
|
|
@ -54,6 +56,7 @@ void braker_init(unsigned char number, unsigned char sensor, unsigned char drop,
|
|||
config.BRAKERS[num].DropPort = drop;
|
||||
config.BRAKERS[num].Relay = relay;
|
||||
config.BRAKERS[num].Timeout = timeout;
|
||||
config.BRAKERS[num].Mode = sensor == 0 ? 1 : 0;
|
||||
brakers[num].config = &config.BRAKERS[num];
|
||||
brakers[num].State = false;
|
||||
brakers[num].OnTime = 0;
|
||||
|
|
@ -61,9 +64,11 @@ void braker_init(unsigned char number, unsigned char sensor, unsigned char drop,
|
|||
if (config.BRAKERS[num].Enable){
|
||||
config.STORE_BRAKER = true;
|
||||
#if PLATFORM_ID != SIMULATOR
|
||||
braker_add_port(config.BRAKERS[num].SensPort);
|
||||
io.num = INPIN[config.BRAKERS[num].SensPort-1];
|
||||
io.enabled=false;
|
||||
if (config.BRAKERS[num].SensPort >0){
|
||||
braker_add_port(config.BRAKERS[num].SensPort);
|
||||
io.num = INPIN[config.BRAKERS[num].SensPort-1];
|
||||
io.enabled=false;
|
||||
}
|
||||
if (config.BRAKERS[num].DropPort >0){
|
||||
braker_add_port(config.BRAKERS[num].DropPort);
|
||||
io.num = INPIN[config.BRAKERS[num].DropPort-1];
|
||||
|
|
@ -84,8 +89,20 @@ void braker_set(string cmd){
|
|||
d("Неверный формат команды = '"+cmd+"'");
|
||||
string type = left(cmd,1);
|
||||
unsigned char num = val(right(cmd,1));
|
||||
brakers[num-1].Fifo += type;
|
||||
d("Бракиратор #"+str(num)+" сигнал ["+type+"]");
|
||||
if (brakers[num-1].config->Mode == 0){
|
||||
brakers[num-1].Fifo += type;
|
||||
d("Бракиратор #"+str(num)+" сигнал ["+type+"]");
|
||||
}
|
||||
else{
|
||||
if (type == "G"){
|
||||
relay_set(brakers[num].config->Relay,true);
|
||||
brakers[num].State = true;
|
||||
d("Бракиратор #"+str(num)+" включен по сигналу сервера");
|
||||
}else{
|
||||
d("Бракиратор #"+str(num)+" получил сигнал 'B'. Игнорируем.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -110,7 +127,7 @@ void braker_proc(unsigned char number)
|
|||
}
|
||||
}
|
||||
}else{ // проверка на сработку
|
||||
if (pinChange(brakers[num].config->SensPort) && getPinStateS(brakers[num].config->SensPort,true)){
|
||||
if (brakers[num].config->Mode==0 && pinChange(brakers[num].config->SensPort) && getPinStateS(brakers[num].config->SensPort,true)){
|
||||
if (braker_get_current(num) == "B"){
|
||||
relay_set(brakers[num].config->Relay,true);
|
||||
brakers[num].State = true;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
#message "link global not defined"
|
||||
#endif
|
||||
|
||||
#define VERSION "2.0b_1905211755"
|
||||
#define VERSION "2.0b_1908141216"
|
||||
#define MAX_FIFO_SIZE 20
|
||||
#define BRAKER_COUNT 3
|
||||
|
||||
|
|
@ -43,6 +43,7 @@ typedef struct BrakerConfig{
|
|||
unsigned char DropPort;
|
||||
unsigned char Relay;
|
||||
unsigned long Timeout;
|
||||
unsigned char Mode;
|
||||
};
|
||||
|
||||
typedef struct BounceConfig{
|
||||
|
|
@ -131,4 +132,5 @@ extern BrakerProcess brakers[BRAKER_COUNT];
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue