Гыыы. I'm finaly find where problem for me - due to incorrect result of this function -
bool mgos_config_is_default_str(const char *s) {
int num_str = (sizeof(mgos_config_str_table) / sizeof(mgos_config_str_table[0]));
for (int i = 0; i < num_str; i++) {
if (mgos_config_str_table[i] == s) return true; // this not always correct
}
return false;
}
And fix for this -
bool mgos_config_is_default_str(const char *s) {
int num_str = (sizeof(mgos_config_str_table) / sizeof(mgos_config_str_table[0]));
for (int i = 0; i < num_str; i++) {
if (strcmp(mgos_config_str_table[i],s) == 0) return true;
}
return false;
}
Now my cc3220 never crashing.
Need make PR.
I've found my issue (1 year ago) and yes, I was using SHA-1 signed certificates and I got that very same error message when trying TLS dual authentication (mOS was the server). The problem might be your certificate. I re-signed with SHA-256 and it worked. I'm sorry I can't run that again to check the ciphersuite string.
Many thanks for this, but I’m not clear what I can do about it. I’m using the standard ca.pem file and the server isn’t under my control. Is there something I need to do to re-sign a certificate with SHA-256 that is saved to my firmware?
let ipURL = "https://api.ipify.org/?format=json";
HTTP.query({
url: ipURL,
success: function (body, full_http_msg) {
let response = JSON.parse(body);
li("IP: " + js(response.ip));
etc...
Hi all,
I've had an issue lately with changing STA the configuration and reconnecting to a network.
My goal is: to reconfigure WiFi credentials without having to reboot. The use case here is that the WiFi credentials were initially misconfigured (wrong password, for example), and I would like the end user to be able to correct the password without rebooting the device. The configuration is done through connecting to the ESP32 in AP mode, so I don’t want the bonding between device and user (mobile phone via app) to be broken.
My actions are: I’ve tried two methods. Each begins with setting the new credentials with mgos_sys_config_set_wifi_sta_ssid() and mgos_sys_config_set_wifi_sta_pass().
I’ve tried (1) calling mgos_wifi_disconnect() and then mgos_wifi_connect(), (2) trying to reset the WiFi sta like so:
struct mgos_config_wifi_sta sta_config = {
.enable = true,
.ssid = ssid,
.pass = pass,
};
mgos_wifi_disconnect();
if (mgos_wifi_setup_sta(&sta_config)) {
mg_rpc_send_responsef(ri, "ok");
} else {
mg_rpc_send_responsef(ri, "couldn't set up sta");
}
where ssid and pass are the new SSID and password, respectively, and (3) seting up the entire WiFi modoule (both AP and STA) such that
mgos_wifi_setup((struct mgos_config_wifi *)mgos_sys_config_get_wifi())
in which case the AP is also restarted, which I do not want. I only want the STA to restart, but not the AP.
The result I see is: I’m still connecting to the same network. Nevertheless, observing
sta_cfg.ssid
and
sta_cfg.pass
seems to have the correct credentials. However, my ESP32 still seems to be connecting with the previous, incorrect password.
Trying to set an incorrect password, for example, will not disconnect me from the AP.
My expectation & question is: I expect to be able to smoothly change WiFi creds while the device is running without any restarts. Is this possible?
I would greatly appreciate your help! Have a great day!
Hello, anyone know of solution to change mos latest 74 to mos release 2.19 in mac mojave?
$ mos version
The Mongoose OS command line tool
Version: 74
Build ID: 74~brew
Update channel: latest
I have tried "mos update release", brew uninstall and re-install, delete and install. At the end still end up mos latest.
ALSO, mos local build on mac os is stuck at "Docker arguments: run ..." for the last 2 hr, cancel build and retry still the same, but was working at least 1 build this morning. However, running mos build in AWS EC2 linux with mos release 2.19 is working.
time_t
defined as number of seconds since epoch? Or is it in another(platform defined) units? If yes, is there some nice way how can i convert value stored in time_t
to seconds?
yes
belongs to first question? 😀
hello folks, having a weird behaviour in mos
tool while trying to add a library to my project.
The library is https://github.com/ellavas/mongoose-lib-hlw8012
, when I checkout the project and build it by itself it works fine (it returns a nice Lib saved to build/lib.a
)
Although, when I add the dependency to my project with
libs:
- origin: https://github.com/ellavas/mongoose-lib-hlw8012
I get the following error:
CC /home/leo/dev/mos/app-demo/build/gen/build_info.c
LD /home/leo/dev/mos/app-demo/build/objs/app-demo.elf
/opt/Espressif/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/9.2.0/../../../../xtensa-lx106-elf/bin/ld: /home/leo/dev/mos/app-demo/build/objs/mgos_deps_init.c.o:(.rodata.mgos_libs_info+0x104): undefined reference to `mgos_mongoose_lib_hlw8012_init'
collect2: error: ld returned 1 exit status
/home/leo/dev/mos/app-demo/deps/modules/mongoose-os/platforms/esp8266/Makefile.build:360: recipe for target '/home/leo/dev/mos/app-demo/build/objs/app-demo.elf' failed
make: Leaving directory '/app'
make: *** [/home/leo/dev/mos/app-demo/build/objs/app-demo.elf] Error 1
Error: exit status 2
any ideas or workaround? I'd be happy to use directly the lib.a
file if there's a way to do so (though is not ideal)
answering my own question for other people benefit, I could either use
binary_libs:
- mylib/mylib.a
as per documentation, or override lib name (the init method apparently is built conventionally using lib name) via
- origin: https://github.com/ellavas/mongoose-lib-hlw8012
name: hlw8012 # this makes the trick
Hello guys, please, how to use correctly TLS client authentication when doing HTTPS request? Is it enough to set path to client certificate and key files:
struct mg_connect_opts opts;
opts.ssl_cert = "client_cert.pem";
opts.ssl_key = "clien_key.pem";
And then pass this opts struct to mg_connect_http_opt
function? Because when i do this as i described i get errors like:
[Mar 1 10:40:35.710] mongoose.c:4912 0x3fff194c received handshake message
[Mar 1 10:40:35.786] mongoose.c:4912 0x3fff194c mbedtls_ssl_flush_output() returned -78 (-0x004e)
[Mar 1 10:40:35.786] mongoose.c:4912 0x3fff194c mbedtls_ssl_write_record() returned -78 (-0x004e)
[Mar 1 10:40:35.786] mongoose.c:4912 0x3fff194c mbedtls_ssl_send_alert_message() returned -78 (-0x004e)
@hdmt-hock Did you try this?
Thank you @nliviu, the links works only after "brew unlink mos". This step is necessary if you have "latest version" installed and want to change to "released version". Please update the documentation. Just a comment, I did know those steps in the link and it did not works previously (meaning before 25 feb), I guess something has changed. Is "mos update release" and "mos update latest" still works?
confused on the parameters given for timer_callback, in particular how to convert the void pointer to an int.
#include "mgos.h"
static void timer_cb(void * arg) {
//int ledPin = *((int *) arg);
int ledPin = *(int*) arg;
static bool s_tick_tock = false;
LOG(LL_INFO,
("%s uptime: %.2lf, RAM: %lu, %lu free on pin %i", (s_tick_tock ? "Tick" : "Tock"),
mgos_uptime(), (unsigned long) mgos_get_heap_size(), (unsigned long) mgos_get_free_heap_size(), ledPin));
s_tick_tock = !s_tick_tock;
if (ledPin >= 0) {
mgos_gpio_toggle(ledPin);
}
}
enum mgos_app_init_result mgos_app_init(void) {
int ledPin = mgos_sys_config_get_board_led1_pin();
if (ledPin >= 0) {
mgos_gpio_setup_output(ledPin, 1);
}
mgos_set_timer(1000 /* ms */, MGOS_TIMER_REPEAT, timer_cb, &ledPin);
LOG(LL_INFO, ("pin %i", ledPin));
return MGOS_APP_INIT_SUCCESS;
}
i have tried the above code on an esp32 and an esp8266 and the results are pretty consistent. the LOG statement in mgos_app_init() will show the correct pin number for LED1 ( 2 or 13 ).
when i try to dereference the void pointer in timer_cb(), it doesn't show the the same number as i pass in; on the esp8266 it will almost always show -1, while on the esp32 it will vary widely.
my intent is to be able to have the same callback function just with a different pin number assigned to it ( and wait time fwiw ) depending on the remain logic.
I'm sure i'm doing something silly and any help would be appreciated. Thank you.
/home/MY_USER_NAME/...
are stripped from final FW binary? Thank you.