22 lines
482 B
Plaintext
22 lines
482 B
Plaintext
#include "global.th"
|
|
|
|
void relay_init(){
|
|
#if PLATFORM_ID != SIMULATOR
|
|
for (int i=1; i++; i< RELAYS){
|
|
io.num = OUTPIN[i-1];
|
|
io.enabled = true;
|
|
}
|
|
d("Relays initialized");
|
|
#endif
|
|
}
|
|
|
|
void relay_set(int number, bool state)
|
|
{
|
|
if (config.debug.RelayReply){
|
|
net_send_data(1,"+"+str(number)+str((state? 1:0))+"\r\n");
|
|
}
|
|
#if PLATFORM_ID != SIMULATOR
|
|
io.lineset(OUTPIN[number-1],!state );
|
|
#endif
|
|
if (config.debug.RelayShow) d("Relay "+str(number)+" is "+ (state? "ON":"OFF"));
|
|
} |