These are chat archives for SmingHub/Sming

23rd
Mar 2016
alon24
@alon24
Mar 23 2016 07:30
@here would it be possible in the libraries in sming, like DB1820b and such, to NOT always print debug messages? What I mean is that while debug messages are important , they clutter my serial, when I try to debug my code using the libriaries
what I am saying is that like I did in infoscreens it would be good to turn off all the debug messages when the code is in sming as lib, since, it clutters,
maybe we need a logging mechanizem, to allow showing messages based on type. so ou could still debug, if u set a debug level. and libraries will honor that too
I did not mean to be seen harsh, its just that I saw this yesterday with ds1820 lib , and thought might mention it
riban-bw
@riban-bw
Mar 23 2016 08:56
I agree with @alon24 that some code can be rather verbose with its debug output which can cause issue with debugging your own code. A mechanism to refine or filter debug messages would be useful. Maybe using a #define to turn on/off all of a specific library's debug at compile time plus the current method of enabling / disabling debug at runtime with CLI. e.g. #define DB1820_DEBUG 0.
Patrick Jahns
@patrickjahns
Mar 23 2016 11:48
@riban-bw @alon24
I do agree that some sort of mechanism would be great. The way riban suggested it, it is currently handled in the sister project esp/arduino
btw. I suggest to put this in an issue to track ideas/suggestions and have it noted somewhere
@all
Does anyone know why changing the wificlient ip is limited to init() ? It should always be possible as long as we are not connected (same goes for APIP - it should always be changeable as long as no clients are connected right?)
And another question - do you guys also experience "dropouts" when the ESP is in AP mode and connects as a client to a station? During developing a web application that communicates with the esp via json api I experience frequent "Network has changed errors" - Desktop browser handle this quite well, but my android phone then immediatly drops the wifi connection which defeats the purpose of having a portal to setup things
Alexander V. Ribchansky
@avr39-ripe
Mar 23 2016 11:59
@patrickjahns :) As I told many times.. ESP has only one PHY, so this real radio transmitter/receiver is shared among STA and SOFTAP mode.. one phy can rx and tx data only on one wifi channel, so SOFTAP channel is always the same as STA channel if they both are enabled.. if firstly SOFTAP is enabled and have some clients connected and then you enable STA mode and STA connects to router on DIFFERENT channel, SOFTAP connections will be dropped, SOFTAP change channel to one used by STA and only then clients can reconnect to ESP SOFTAP.. moreover, if both sta and softap are enabled, and sta scans for networks/or try to connect to some ssid it change channel in a loop, so it is some cind hard to connect to esp softap.. this is known esp8266 limitations ;(
Patrick Jahns
@patrickjahns
Mar 23 2016 12:00
@avr39-ripe
Thanks for clarification - must have avoided that until now - any suggestions on how to "improve" this?
Alexander V. Ribchansky
@avr39-ripe
Mar 23 2016 12:02
@patrickjahns also see my comment to you issue on wifi..
Patrick Jahns
@patrickjahns
Mar 23 2016 12:02
The second issue I frequently experience while testing some connection code - when the configuration is stored in esp eeprom and the AP is not available - I have no way of connecting. It needs a hard reset for the init() method to properly run and clear any saved settings
riban-bw
@riban-bw
Mar 23 2016 12:03
@patrickjahns I would only use AP for initial setup and disable client during this period.
Alexander V. Ribchansky
@avr39-ripe
Mar 23 2016 12:03
@patrickjahns look to my Basic_WebSkeletonApp I try to solve such issue..
look to FRESH version in my repo.. no pr yet.. try to clear wifi things.. catch some bugs..
you also need Sming from my repo, or just cherry-pick latest commits.. I add some wifi related Sming wrappers and fix (as I think) wrong behaviour of WifiStation.config
will test a bit and make PR for those changes..
Patrick Jahns
@patrickjahns
Mar 23 2016 12:08
@riban-bw
I am trying to provide an "initial setup" - there the user needs to select the desired accesspoint and enter credentials for connection. Then via JSON(AJAX) Api I transmit the credentials to the ESP which tries to connect. The Frontend regularly polls the connection status of the ESP and informs the user if it is successfull or not. The problem though is, when ESP drops the AP clients to connect to STA, the flow is interrupted. On my laptops this only results in errors in the web browser which I can deal with in the WebApplication - but on my android phone, it looses the connection to the AP completely
Alexander V. Ribchansky
@avr39-ripe
Mar 23 2016 12:10
My way of doing things is as follows:
ESP always try to connect to stored SSID using stored PASSWORD
if cannot connect it starts OWN AP
then you can connect to AP and change settings (if needed, mat be no connection is due to router downtime!)
if new settings lead to STA mode successful connection and IP is got from routers DHCP OWN AP shuts down
own ap also automatically shuts down when STA mode connection is restored without user interaction (if router UP and running again after downtime)
I think it is very handy and consistent way of doing things :)
try my app, it solves you task.. it only lack two things - no scanning for networks - you should enter ssid password manually, no static ip yet..
and remember, there is no need to store ssid/password to another config.. job is done by sdk wifi*[set/get]_config[_default] :)
Patrick Jahns
@patrickjahns
Mar 23 2016 12:14
@avr39-ripe
I will have a look - I am doing basically the same, yet there are some caveats with the sdk provided functions and sming functions. As you mentioned some things seem a bit "wonky" and I am almost at the point of writing my own classes for the task
Alexander V. Ribchansky
@avr39-ripe
Mar 23 2016 12:15
@patrickjahns my investigation lead me to app provided.. Almost do the job for me...
Patrick Jahns
@patrickjahns
Mar 23 2016 12:18
thanks - did you play around with static ips? I find the limitation for AP/STA for only setting up IP configuraiton in INIT cumbersome - I didn`t find these limitations with arduino esp
and I can`t seem to track them in the official nonos sdk documentaiton
Alexander V. Ribchansky
@avr39-ripe
Mar 23 2016 12:19
not yet.. will do it later.. I whant this feature as option to WebSkeletonApp...
for sta/ap save...
Patrick Jahns
@patrickjahns
Mar 23 2016 13:02
@avr39-ripe
I think a good addition to your example would be to wait X tries (or X seconds) before the AP is actually started. It might be that initially it was not properly reachable/took some more tries to connet - any thoughts on this?
(that`s why I preferred the "waitConnection" method beforehand
Alexander V. Ribchansky
@avr39-ripe
Mar 23 2016 13:03
@patrickjahns starting AP immediately dosen't hurts.. if later STA connects it automatically disables SOFTAP.. so I think there is no need to wait some time before start AP...
when AP started, STA do not stop to reconnect...
Patrick Jahns
@patrickjahns
Mar 23 2016 13:07
For me it seems as a security risk - especially if the AP is not secured
Alexander V. Ribchansky
@avr39-ripe
Mar 23 2016 13:07
AP is secured, no risk..
you can implement desired behaviour very simply, just add some counter in onSTADisconnect and fire AP only when counter >= some value.. and thero this counter in onSTAGotIP..
but again, it is useless AFAIK :)
Patrick Jahns
@patrickjahns
Mar 23 2016 13:13
Depends on the way you look at it - also I don`t find it practical to directly disable the AP when we connect - this way we can not inform the user that it actually connected and there was not any other issue etc... ;-)
different question - it seems that you have a lot of enable/disable in your proposed example - As far as I understood the part with wifi_set_opmode(mode) is, that it always saves to eeprom - thus we would cycle through available eeprom write/deletes more often. Especially if you have a flaky AP or the connection is just bad
Alexander V. Ribchansky
@avr39-ripe
Mar 23 2016 13:15
@patrickjahns partly agree with you.. huge disadvantage of immediately disable AP as soon as we connected to STA is need to find out STA IP if in dhcp (currently default and only ) mode..
Patrick Jahns
@patrickjahns
Mar 23 2016 13:17
I circumvent this by having the client aknowledge that esp is connected and let the client issue the command of stopap/restart (static ip)
currently I have a backup timer if the client disappeared - but in general I try to avoid the problem with clients disappearing
Alexander V. Ribchansky
@avr39-ripe
Mar 23 2016 13:19
my design is based on following:
  • 99% of time I need my ESP to automatically connect to predefined SSID in STA mode
  • very rarely I need reconfigure my device
  • configuration ease isn't MAIN PRIORITY
  • main priority is reliable connectivity in sta mode..
timer for softap disable.. hmm! GOOD IDEA!
Patrick Jahns
@patrickjahns
Mar 23 2016 13:21
Well my priorities are 1) ease of use 2) reliability - I write the firmware so anyone can easily setup and use it
Alexander V. Ribchansky
@avr39-ripe
Mar 23 2016 13:21
that sounds good for me :) thanks! will think about such addition for next ver of WebSkeletonApp.. now I want to finish submitting rewritten ver and push to sming my addition..
Patrick Jahns
@patrickjahns
Mar 23 2016 13:22
(main project is a Led Controller currently - offering the PCB and Firmware as OpenHardware+Software to some forum members)
Alexander V. Ribchansky
@avr39-ripe
Mar 23 2016 13:22
one head is good, and tw heads are better (old russian proverb) :)
Patrick Jahns
@patrickjahns
Mar 23 2016 13:22
hehe any help appreciated ;-)
Alexander V. Ribchansky
@avr39-ripe
Mar 23 2016 13:23
@patrickjahns my main project is heating controller with remote tempsensors and remote switches for heaters and main controller to control heating equipment (pumps, valves, caldrons..)
so thanks again for good idea about disable softap not immediately, but with some timer... hurra, I will see my STA IP!! no more need to login to router (yes! you know, I'm lazzy monkey) :))
alon24
@alon24
Mar 23 2016 13:32
opened up SmingHub/SmingRTOS#96
Fangorn-SPB
@Fangorn-SPB
Mar 23 2016 13:42
Hi, All!
Anybody try MCP4726 with sming?
Alexander V. Ribchansky
@avr39-ripe
Mar 23 2016 13:44
@Fangorn-SPB hello, me - not ;( just port expanders...
Fangorn-SPB
@Fangorn-SPB
Mar 23 2016 13:45
intresting, can esp decode some poor mp3...
Alexander V. Ribchansky
@avr39-ripe
Mar 23 2016 13:46
@Fangorn-SPB people handle it somehow.. but they use I2S.. try to google about esp + mp3..
Fangorn-SPB
@Fangorn-SPB
Mar 23 2016 13:47
i need whey as ringtone, no quallity needed
Fangorn-SPB
@Fangorn-SPB
Mar 23 2016 14:20
sorry, i can use for i2c any free gpio ports, right?
Alexander V. Ribchansky
@avr39-ripe
Mar 23 2016 14:56
@Fangorn-SPB yes, any free gpio.. just configure them in Wire.pins before Wire.begin!!!
Alexander V. Ribchansky
@avr39-ripe
Mar 23 2016 15:22
@hreintke are you here?
hreintke
@hreintke
Mar 23 2016 19:30
@avr39-ripe :
Now I am :smile:
Curtis Pope
@piperpilot
Mar 23 2016 20:57
@avr39-ripe & @patrickjahns I am working on the same thing for my project...following your discussion. I have a modified version of httpServer_configNetwork that works pretty well, but it uses some of the older callbacks and timeouts.
alonewolfx2
@alonewolfx2
Mar 23 2016 21:50
@avr39-ripe any progress on webskeleton issue?
Alexander V. Ribchansky
@avr39-ripe
Mar 23 2016 21:50
@alonewolfx2 wait a bit.. PR :))))
alonewolfx2
@alonewolfx2
Mar 23 2016 21:51
:)
hreintke
@hreintke
Mar 23 2016 21:52
@avr39-ripe :
I am in again, still have a remark for me or it it solved :smile:
Alexander V. Ribchansky
@avr39-ripe
Mar 23 2016 21:53
@hreintke what remark? about sta softap opmode?? will do it tomorrow (i hope)
huh.. 4 PR in.. comments, critic.. fire :)))
hreintke
@hreintke
Mar 23 2016 21:54
avr39-ripe
16:22
@hreintke are you here?
Alexander V. Ribchansky
@avr39-ripe
Mar 23 2016 21:55
@hreintke oh,, sorry, nevermind.. I whant to ask you about PR split.. but decide it myself...
hreintke
@hreintke
Mar 23 2016 21:55
OK.
Alexander V. Ribchansky
@avr39-ripe
Mar 23 2016 21:56
@hreintke so please find time to look for my pr in nonos sming.. after we finnally merge it, I will port them to rtos..
@all any comments and critic is welcome :)
alonewolfx2
@alonewolfx2
Mar 23 2016 21:58
@avr39-ripe is issue solved?
Alexander V. Ribchansky
@avr39-ripe
Mar 23 2016 21:59
@alonewolfx2 for quick test of new webskeletonapp just use my repo with all included :) https://github.com/avr39-ripe/Sming/tree/feature/web_skeleton_app
@alonewolfx2 yes..
try it
Patrick Jahns
@patrickjahns
Mar 23 2016 22:09
@avr39-ripe
great PRs - pretty much covers also the issues I experienced
hreintke
@hreintke
Mar 23 2016 22:09
@avr39-ripe :
What is your plan ? for quick test of new webskeletonapp just use my repo with all included
The PR you made only contains part of the update you want to do ?
Patrick Jahns
@patrickjahns
Mar 23 2016 22:10
@piperpilot
do you have a repo link?
Generally I`ve been investigating the issue with android a bit more - android is quite picky about things - quite annoying in general. (i.e. when not providing generate_204 , android will show a captive portal message - but the captive portal login screen immediatly disappears, once the wifi connection is flaky (which happens during esp trying connect as STA) )
Generally I wonder if it is good to also include WPS as option ? anyone tried to include it in sming yet?
@hreintke - is there a way to get the size of TemplateFileStream before we send it to the client? I`ve been adding "Content-Length" headers to the httpserver responses - helps with connection closing
hreintke
@hreintke
Mar 23 2016 22:28
@patrickjahns :
Never been in the nitty gritty details of TemplateFileStream but don't expect so.
Alexander V. Ribchansky
@avr39-ripe
Mar 23 2016 23:01
@hreintke all my work is split into four pr.. all published.. it also need pr from @patrickjahns for proper operation pr about buffer split.. I provide link to my repo for quick tests; )