These are chat archives for SmingHub/Sming

28th
Nov 2015
Murli Shenoy
@hmms
Nov 28 2015 08:36
i was playing around with the HTU21DF sensor, im trying to call the readHumidity function from with in a while loop in the init() function and that works, but when I call it with the timer, the function does not work and does not retrieve the values as desired, any pointers on what could be the issue?
i'm modifying the bmp180 example app
blob
Murli Shenoy
@hmms
Nov 28 2015 08:41
blob
hreintke
@hreintke
Nov 28 2015 08:57
@hmms :
In the timer implementation you have a Wire.begin() every cycle, in the other not. Could that be the issue ?
Murli Shenoy
@hmms
Nov 28 2015 08:58
it seems like the sensor takes like ~400ms to respond and the driver times out before that.
and yes you are right there should not be a wire.begin() in both of them, i was just trying some stuff. wire.begin did not make any difference.
hreintke
@hreintke
Nov 28 2015 09:03
In the loop() you have Serial.print("\tHumidity1: "); in the timer you have Serial.print("\tHumidity: ");
in your error putty I see Humidity1 ??
Murli Shenoy
@hmms
Nov 28 2015 09:03
i tried making a local function to verify there was some issue with the function call.
sorry for the confusion
hreintke
@hreintke
Nov 28 2015 09:11
Then someone with knowledge on the sensor need to help you out. I have no experience in that.
But.. you absolutely should use the timer in your application. Using the delay will cause numerous issues with stability and connectivity to the wifi
ystrem
@ystrem
Nov 28 2015 09:11
hi
Murli Shenoy
@hmms
Nov 28 2015 09:12
yes I understand, i just wanted to verify that the driver itself fucntions.
ystrem
@ystrem
Nov 28 2015 09:12
What SPI do you use HW or SW ?
Murli Shenoy
@hmms
Nov 28 2015 09:14
@hreintke Will a delay function in the driver cause issues?
the sparkfun driver that i'm using to read the sensor uses delays to wait for the sensor to respond, but i'm thinking that the timer times the function out before the sensor reponds?
hreintke
@hreintke
Nov 28 2015 09:19
The timer will never fire within a delay. The delay() function just "keeps the cpu busy" for the specified amount of time -> all callbacks will not work in that period
You can look at the ds18s20 library, that has complete timer usage within the library.
Murli Shenoy
@hmms
Nov 28 2015 09:23
cool, i increased the delay within the driver from 1ms to 10ms and the sensor is now responding
the only issue i now have is that, the first few readings are erronous
it works, now i'm trying to find an elegant solution
Murli Shenoy
@hmms
Nov 28 2015 09:40
i was running the process at 1 second interval, i increased the timerproc timer interval to 10 second and now the code works perfectly! :smile: thanks @hreintke
Alexander V. Ribchansky
@avr39-ripe
Nov 28 2015 13:41
@hreintke HELLO! Your suggestion to TcpConnection::close is absolutely FANTASTIC!!! 250..350 ms on sdk1.4.x + sming/develop instead of more than 1 second!!!
hreintke
@hreintke
Nov 28 2015 15:56
@avr39-ripe :
Ok, glad it helped :smile: I will submit a PR soon.
Dmitry Kireev
@kireevco
Nov 28 2015 17:38
how do interrupt work?
from the hardware part, what is considered an iterrupt?
zhivko
@zhivko
Nov 28 2015 17:43
Is it possible to output the underlaying SDK wifi operations? I use esp and sming for stepper step gpio, and it works but I hear ticks every now and hen and it seems like inconsistent operation. I use while loop and smal 10us delays in this while loop and watchdog feed. But It seems like code in behind is doing something that disturbs operation...
I would like to see what is this code in behind...
zhivko
@zhivko
Nov 28 2015 17:55
Now I have Serial.systemDebugOutput(true); - but this doesn't show all activities in serial out from underliying SDK.
alonewolfx2
@alonewolfx2
Nov 28 2015 18:30
We update sdk1.4 a couple days ago but now espressif has new sdk :D sdk 1.5 released
zhivko
@zhivko
Nov 28 2015 18:35
:) Uaauu
They are fast ;)
alonewolfx2
@alonewolfx2
Nov 28 2015 18:37
Actually there is no big difference but it seems wpa2-enterprise and some rf improvement
And ssl cert things but we don't have ssl in sming right :D
And much more udp improvement
zhivko
@zhivko
Nov 28 2015 18:50
do you maybe know how can I output info from background activity from SDK ?
I have this simple gpio for stepper but gpio is interrupted and that results in unsmooth rotation of stepper...
maybe I should move hw timer interrupt? if it exist?
zhivko
@zhivko
Nov 28 2015 19:45
@alonewolfx2 do we know esp32 release date?
zhivko
@zhivko
Nov 28 2015 19:55
no exact dates... "ESP32 to be released next year" but next year is very long :)
Could this article is to be read as ESP31 would be realeased still in 2015 ?
Dmitry Kireev
@kireevco
Nov 28 2015 19:56
@zhivko feels like that
zhivko
@zhivko
Nov 28 2015 19:58
that is two months to go :)
Dmitry Kireev
@kireevco
Nov 28 2015 19:59
@zhivko lol, that’s true
I feel like esp32 should come out 1st quarter
zhivko
@zhivko
Nov 28 2015 19:59
I have this loop for running stepper motors - and also reading keyboard from serial makes annoyances on stepper rotations
I think dedicated core for wifi will solve this - what do you think @kireevco
Dmitry Kireev
@kireevco
Nov 28 2015 20:00
China will find a place to place a bug
:-D
but I hope that would be a better QAed system
zhivko
@zhivko
Nov 28 2015 20:03
What? You think it will be buggy ?
ESP31 ?
Dmitry Kireev
@kireevco
Nov 28 2015 20:04
well, everything is buggy
:)
isn’t it?
it’s the approach
zhivko
@zhivko
Nov 28 2015 20:05
Yes, but I think it is related because everything is based on 1 core
Dmitry Kireev
@kireevco
Nov 28 2015 20:05
hehe
zhivko
@zhivko
Nov 28 2015 20:05
HAs anybody thought to port SMING to RTOS ?
Dmitry Kireev
@kireevco
Nov 28 2015 20:05
arduino made atmel very stable
:)
I don’t think it’s the HW issue.
zhivko
@zhivko
Nov 28 2015 20:05
yes... over long long time :)
Dmitry Kireev
@kireevco
Nov 28 2015 20:05
it is QA
but now, it can be a commercial device
like others
zhivko
@zhivko
Nov 28 2015 20:06
Maybe in RTOS esp8266 behaves more controllable?
No quirks in background...
I think Espressif don't have so much resources for good QA like Atmel
Dmitry Kireev
@kireevco
Nov 28 2015 20:08
@zhivko they don’t want it...
:)
actualy, they do
they have bug hunt
but imho they need more
zhivko
@zhivko
Nov 28 2015 20:08
Yes I know...
But if they would release their code to opensource it - the bugs would be easier to find...
For example ... I would like to know why serial input is interupting GPIO activities... ?
Dmitry Kireev
@kireevco
Nov 28 2015 20:10
@zhivko yep.
zhivko
@zhivko
Nov 28 2015 20:10
How is that possible?
Dmitry Kireev
@kireevco
Nov 28 2015 20:10
well, with i386 platforms, we had IRQs
I don’t know if you remember, when printers were on the same IRQs as modems
:)
obviously there is a reason
zhivko
@zhivko
Nov 28 2015 20:11
yes - hw limitation probably
ANd now here is PI ZEro - man is thinking why should I invest my time in esp there is PI there...
Dmitry Kireev
@kireevco
Nov 28 2015 20:12
I saw p0
crazy
well, pi is and will be closed
there is a chance that esp will be open
CHANCE
zhivko
@zhivko
Nov 28 2015 20:15
yes OK... see this guy is making hat for PI zero - that will include surface mount NIC:
https://openhardwarecoza.wordpress.com/2015/11/27/raspberry-pi-zero-grbl-all-in-one-cnc-controller/
its 1GHz for
hreintke
@hreintke
Nov 28 2015 20:21
@zhivko :
When using RTOS you still have espressif on the background running f.e. wifi
zhivko
@zhivko
Nov 28 2015 20:21
@hreintke: I dissabled wifi, and trying to move stepper mottors - but stil quirks!!!
cannot believe it - what the hell is it working?
what are this interrupts to MY PROGRAM ?? I want to know :)
if you understand me
It is very interesting because If I do "connect" to get an IP there is more interrupts randomly to the stepper movements...
hreintke
@hreintke
Nov 28 2015 20:28
Yes, I do understand. But currently there is no way to get info on background activity.
I think only way to be sure your app runs at fixed timing is using hw-timer. That uses NMI interrupt so always should fire.
@johndoe8967 did something like that for servo's #444
zhivko
@zhivko
Nov 28 2015 20:28
@hreintke is it possible to allow sdk processing to be printed to serial ?
hreintke
@hreintke
Nov 28 2015 20:29
No, nothing is coming from sdk execpt startup messages
if you connect to get an IP you will get wifi traffic which (I presume) will generate interrupts -> interfere with your code
@alonewolfx2 :
udp improvements are espressif network layer only. Sming is not using that.
zhivko
@zhivko
Nov 28 2015 20:35
@hreintke I assume there is no chance to lower priority on wifi parsing tasks...
Or to block any other processing other than my code ?
for a while (lets say 5 seconds)... ?
hreintke
@hreintke
Nov 28 2015 20:46
No, no chance. But think what you want. How would you expect a wifi connection/gpio processing stay working correctly when you block that for 5 seconds.
I think (but am not the expert on this), you will need hwtimer or "external" microcontroller to handle very time critical tasks. Maybe esp-32 with two cpu's will solve (part of) this, but of course that is still very unclear.
zhivko
@zhivko
Nov 28 2015 20:56
I am looking @johndoe8967 example - I will try that but #include <HardwareTimer.h> is not part of SMING ?
If it's ok why dont we include it in SMING ?
crosofg
@crosofg
Nov 28 2015 21:02
can someone include a parameter in the Timer class to execute a timer a particular number of times?
Alexander V. Ribchansky
@avr39-ripe
Nov 28 2015 21:03
@crosofg just add external variable to control how many times execute a timer callback | delegate and disarm timer when counter > max_counts :)
hreintke
@hreintke
Nov 28 2015 21:05
@zhivko :
When @johndoe8967 example is PR'ed the hwtimer will be separate and become part of Sming core
zhivko
@zhivko
Nov 28 2015 21:35
@hreintke - I will pul it into my repo and see how it goes... Are you using OTA maybe?
zhivko
@zhivko
Nov 28 2015 22:04
@hreintke: WOW hardware timer from @johndoe8967 working 100% :)
Thanks for directing me in right direction!!
no interrupted GPIOs!
Also with WIFI on!
Alexander V. Ribchansky
@avr39-ripe
Nov 28 2015 22:05
@zhivko is there Timer copmatible interface with hwtimer??
can I simply arm hwtimers as with Timer I arm sw timer?
zhivko
@zhivko
Nov 28 2015 22:08
No, I dont think so.
Alexander V. Ribchansky
@avr39-ripe
Nov 28 2015 22:08
@zhivko :(
zhivko
@zhivko
Nov 28 2015 22:09
I am asking my selve - why don't we use real hw timer instead Timer ? I hope @johndoe8967 s timer will be merget to SMING asap...
Alexander V. Ribchansky
@avr39-ripe
Nov 28 2015 22:09
can anybody tell how many hw timers has esp8266? only one or.. ??
zhivko
@zhivko
Nov 28 2015 22:10
@hreintke: @johndoe8967 should make PR request - yes ?
avr39 - I think yes
Alexander V. Ribchansky
@avr39-ripe
Nov 28 2015 22:10
@zhivko again :( but even with 1 hw timer we can make good things...
anybody try sdk 1.5.0? need we modify some Makefile fo -lcrypt ?
zhivko
@zhivko
Nov 28 2015 22:23
Not me but I can try...
hreintke
@hreintke
Nov 28 2015 22:23
@zhivko : @avr39-ripe :
Read the hwtimer api doc in the SDK_programming guide.
And beware, you are using NMI interrupts, be careful with the things you process into the timer.
As is in the doc, it interferes with hw-pwm, you cannot use both in one application.
Maybe we should integrate hwtimer and timer, but certainly not replace timer.
Lots of timer implementations do not need the specific timing.
zhivko
@zhivko
Nov 28 2015 22:25
@hreintke OK thank you - good to know - And I agree there are scenarios where time interrupts are not critical than one can still use SW timer - for time critical HW timer....
@hreintke: another thing that bothers me but is not so critical is that OTA stucks in the process of updating - sometimes just goes through but another times stuck for 30 seconds or more...
hreintke
@hreintke
Nov 28 2015 22:30
@zhivko : I presume you mean rBoot OTA.
Probably it is your network which causes the "stuck" OTA. I've seen that before.
@avr39-ripe : what would need -lcrypt ?
zhivko
@zhivko
Nov 28 2015 22:37
@hreintke: can you be more specific? What in network? Bad wifi?
hreintke
@hreintke
Nov 28 2015 22:48
No, can't be more specific. It is the tcp connection over the wifi. So in most cases it will be wifi related.
I am out, tomorrow next.
zhivko
@zhivko
Nov 28 2015 22:49
Like some wifi retry should happen quicker than waiting so long?
hreintke
@hreintke
Nov 28 2015 22:49
yes
zhivko
@zhivko
Nov 28 2015 22:49
@hreintke Thank you very much you were VERY helpful...
@hreintke I do not need to wait for esp32 now ;)
what is GREAT.
hreintke
@hreintke
Nov 28 2015 22:50
Yep sure, you never know when and with what quality new products arrive :smile:
crosofg
@crosofg
Nov 28 2015 23:23
Hi what should be chnaged in hte follwoing code so that timercb is called?
This message was deleted
void Bulb::timerCb() {
//    Bulb *self = (Bulb*) arg;
    debugf("PRinttin");
}

/*setting color to bulb depending on mode ? smooth or sudden*/

void Bulb::setColortoGroup(ColorRGB color) {
    if (transitionSmooth) {
        // code for smooth Transiton

        fraction = 0;
        lastColor = getColorfromBulb();
        finalColor = color;
        debugf("REached here");
        pwmTimer.initializeMs(10 /*/ fps*/, timerCb);
        pwmTimer.start();
    } else {
        // code for sudden Transiton
        presentColor = color;
        setColortoBulb(presentColor);
//        EspPWM
    }
}