Skip to content

Commit

Permalink
minor corrections for gpio controller
Browse files Browse the repository at this point in the history
  • Loading branch information
suraj committed Aug 22, 2021
1 parent d7b3541 commit 3eaf0b7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/service_provider/GpioServiceProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ void GpioServiceProvider::applyGpioJsonPayload( char* _payload, uint16_t _payloa

uint8_t _mode = StringToUint8( _pin_mode, _pin_values_max_len );
uint16_t _value = StringToUint16( _pin_value, _pin_values_max_len );
uint16_t _value_limit = _mode == ANALOG_WRITE ? ANALOG_GPIO_RESOLUTION : 2;
uint16_t _value_limit = _mode == ANALOG_WRITE ? ANALOG_GPIO_RESOLUTION : _mode == DIGITAL_BLINK ? _value+1 : 2;
this->m_gpio_config_copy.gpio_mode[_pin] = _mode < ANALOG_READ ? _mode : this->m_gpio_config_copy.gpio_mode[_pin];
this->m_gpio_config_copy.gpio_readings[_pin] = _value < _value_limit ? _value : this->m_gpio_config_copy.gpio_readings[_pin];
__database_service.set_gpio_config_table(&this->m_gpio_config_copy);
Expand Down
6 changes: 3 additions & 3 deletions src/webserver/controllers/GPIOController.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class GpioController : public Controller {
_response += !this->m_route_handler->has_active_session();
_response += ",\"d\":";
__gpio_service.appendGpioJsonPayload(_response);
_response += ",\"md\":[\"OFF\", \"DOUT\", \"DIN\", \"AOUT\", \"AIN\"]";
_response += ",\"md\":[\"OFF\", \"DOUT\", \"DIN\", \"BLINK\", \"AOUT\", \"AIN\"]";
_response += "}";

this->_last_monitor_point.x = x2;
Expand Down Expand Up @@ -298,7 +298,7 @@ class GpioController : public Controller {
strcat_P( _page, EW_SERVER_HEADER_HTML );
strcat_P( _page, EW_SERVER_GPIO_CONFIG_PAGE_TOP );
char* _gpio_mode_general_options[] = {"OFF", "DOUT", "DIN", "BLINK", "AOUT"};
char* _gpio_mode_analog_options[] = {"OFF", "", "", "", "AIN"};
char* _gpio_mode_analog_options[] = {"OFF", "", "", "", "", "AIN"};

char _name[4], _label[4];memset(_name, 0, 4);memset(_label, 0, 4);
strcpy( _name, "D0:" );strcpy( _label, "d0" );
Expand All @@ -309,7 +309,7 @@ class GpioController : public Controller {
if( !__gpio_service.is_exceptional_gpio_pin(_pin) )
concat_tr_select_html_tags( _page, _name, _label, _gpio_mode_general_options, 5, (int)__gpio_service.m_gpio_config_copy.gpio_mode[_pin], _exception );
}
concat_tr_select_html_tags( _page, (char*)"A0:", (char*)"a0", _gpio_mode_analog_options, 5, (int)__gpio_service.m_gpio_config_copy.gpio_mode[MAX_NO_OF_GPIO_PINS] );
concat_tr_select_html_tags( _page, (char*)"A0:", (char*)"a0", _gpio_mode_analog_options, 6, (int)__gpio_service.m_gpio_config_copy.gpio_mode[MAX_NO_OF_GPIO_PINS] );

strcat_P( _page, EW_SERVER_WIFI_CONFIG_PAGE_BOTTOM );
if( _enable_flash )
Expand Down

0 comments on commit 3eaf0b7

Please sign in to comment.