Skip to content

Commit

Permalink
channel value changed improvement & two methods moved to the public s…
Browse files Browse the repository at this point in the history
…cope
  • Loading branch information
przemyslawzygmunt committed Oct 30, 2017
1 parent 89b0107 commit 2ec31b6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
7 changes: 2 additions & 5 deletions libraries/SuplaDevice/SuplaDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -589,10 +589,7 @@ void SuplaDeviceClass::iterate(void) {

channel_pin[a].time_left = 0;

if ( Params.reg_dev.channels[a].Type == SUPLA_CHANNELTYPE_SENSORNO )
channel_pin[a].last_val = -1;

else if ( Params.reg_dev.channels[a].Type == SUPLA_CHANNELTYPE_RELAY )
if ( Params.reg_dev.channels[a].Type == SUPLA_CHANNELTYPE_RELAY )
channelSetValue(a, 0, 0);

} else if ( channel_pin[a].time_left > 0 ) {
Expand Down Expand Up @@ -629,7 +626,7 @@ void SuplaDeviceClass::iterate(void) {
channel_pin[a].last_val = val;

if ( channel_pin[a].time_left <= 0 ) {
channel_pin[a].time_left = 500;
channel_pin[a].time_left = 100;
channelValueChanged(Params.reg_dev.channels[a].Number, val == HIGH ? 1 : 0);
}

Expand Down
5 changes: 3 additions & 2 deletions libraries/SuplaDevice/SuplaDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ class SuplaDeviceClass
void setString(char *dst, const char *src, int max_size);
int addChannel(int pin1, int pin2, bool hiIsLo, bool bistable);
void channelValueChanged(int channel_number, char v, double d, char var);
void channelValueChanged(int channel_number, char v);
void channelDoubleValueChanged(int channel_number, double v);
void channelSetValue(int channel, char value, _supla_int_t DurationMS);
void channelSetDoubleValue(int channelNum, double value);
void setDoubleValue(char value[SUPLA_CHANNELVALUE_SIZE], double v);
Expand Down Expand Up @@ -139,6 +137,9 @@ class SuplaDeviceClass
SuplaDeviceClass();
~SuplaDeviceClass();

void channelValueChanged(int channel_number, char v);
void channelDoubleValueChanged(int channel_number, double v);

bool begin(IPAddress *local_ip, char GUID[SUPLA_GUID_SIZE], uint8_t mac[6], const char *Server,
int LocationID, const char *LocationPWD);

Expand Down

0 comments on commit 2ec31b6

Please sign in to comment.