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

Define your own host and port by command. #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Define your own host and port by command. #3

wants to merge 1 commit into from

Conversation

fvpalha
Copy link

@fvpalha fvpalha commented Jul 26, 2016

Hi @raburton

With this tiny change is possible define the host and the port of server.

A sample code:

void config_cmd_ota(uint8_t argc, char *argv[]) {
    char msg[50];
    char *val;
    char *host = argv[1], *port = argv[2];

    if (argc == 0) {
        val = "192.168.1.107";
        setOtaHostIp (val);
        setOtaHostPort (80);
    } else if (argc == 1) {
        setOtaHostIp (host);
        setOtaHostPort (80);
    } else if (argc == 2) {
        setOtaHostIp (host);
        setOtaHostPort (atoi(port));
    }

    //disable global interrupt
    ETS_GPIO_INTR_DISABLE();
    // start the upgrade process
    if (rboot_ota_start((ota_callback)OtaUpdate_CallBack)) {
        os_sprintf(msg, "Updating...");
    } else {
        os_sprintf(msg, "Updating failed!");
    }
    uart0_send(msg);
}

@fvpalha
Copy link
Author

fvpalha commented Jul 26, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant