Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added RF Tx power as a command #466

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ Any part of a command line input after a single "#" until the end of the line wi

### Chip Config
- set speed [80|160]: sets the CPU clock frequency (default 160 Mhz)
- set power [0-82]: sets the RF Tx power
- sleep _seconds_: Put ESP into deep sleep for the specified amount of seconds. Valid values between 1 and 4294 (aprox. 71 minutes)
- set status_led _GPIOno_: selects a GPIO pin for the status LED (default 2, >16 disabled)
- set hw_reset _GPIOno_: selects a GPIO pin for a hardware factory reset (>16 disabled, default)
Expand Down
2 changes: 1 addition & 1 deletion user/user_config.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef _USER_CONFIG_
#define _USER_CONFIG_

#define ESP_REPEATER_VERSION "V2.2.16"
#define ESP_REPEATER_VERSION "V2.2.17"

#define LOCAL_ACCESS 0x01
#define REMOTE_ACCESS 0x02
Expand Down
14 changes: 12 additions & 2 deletions user/user_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ void ICACHE_FLASH_ATTR user_do_ping(const char *name, ip_addr_t *ipaddr, void *a
os_sprintf(response, "DNS lookup failed for: %s\r\n", name);
to_console(response);
system_os_post(0, SIG_CONSOLE_TX, (ETSParam)currentconn);
return;
return;
}

ping_opt.count = 4; // try to ping how many times
Expand Down Expand Up @@ -1224,7 +1224,7 @@ void ICACHE_FLASH_ATTR console_handle_command(struct espconn *pespconn)
#endif
os_sprintf_flash(response, "] <val>\r\n");
to_console(response);
os_sprintf_flash(response, "set [speed|status_led|hw_reset|config_port|config_access|web_port] <val>\r\nsave [config|dhcp]\r\nconnect|disconnect|reset [factory]|lock|unlock <password>|quit\r\n");
os_sprintf_flash(response, "set [speed|power|status_led|hw_reset|config_port|config_access|web_port] <val>\r\nsave [config|dhcp]\r\nconnect|disconnect|reset [factory]|lock|unlock <password>|quit\r\n");
to_console(response);
os_sprintf_flash(response, "set [client_watchdog|ap_watchdog] <val>\r\n");
to_console(response);
Expand Down Expand Up @@ -2721,6 +2721,16 @@ void ICACHE_FLASH_ATTR console_handle_command(struct espconn *pespconn)
goto command_handled;
}

if (strcmp(tokens[1], "power") == 0)
{
uint16_t power = atoi(tokens[2]);
if (power > 82)
power = 82;
system_phy_set_max_tpw(power);
os_sprintf(response, "RF Tx Power updated %d\r\n", power);
goto command_handled;
}

if (strcmp(tokens[1], "status_led") == 0)
{
if (config.status_led <= 16)
Expand Down