These are chat archives for esp8266/Arduino

2nd
Mar 2016
Aditya Tannu
@AdySan
Mar 02 2016 02:51
This is kinda opposite of @Links2004's VNC Client library, its a VNC Host. I'm not interested in the game as much, but this could be used to host some interesting UI's. Basically anything that goes into a display buffer for a little LCD screen. https://www.reddit.com/r/esp8266/comments/48i1rd/pylotron_vncbased_esp8266_multiplayer_first/
CHAE-PIL LIM
@chaeplin
Mar 02 2016 02:54
news : http://www.pycom.io/pycom-partners-with-espressif/ Pycom and Espressif have agreed a long term supply relationship for Pycom products. Our LoPy will be powered by their ESP32, a state of the art and future generation SoC.
Aditya Tannu
@AdySan
Mar 02 2016 02:54
Isn't this one approach to ArduCam projects? @mozgy @tzapu
@chaeplin Yeah, saw that this morning, shipping Aug '16, sounds great
but I'm afraid it'll be more like the NodeMCU case, where the Dev Kit clones are incredibly popular, but a much smaller population actualy uses the NodeMCU Lua firmware
CHAE-PIL LIM
@chaeplin
Mar 02 2016 02:57
They use micro python, so may be..
Aditya Tannu
@AdySan
Mar 02 2016 03:00
yeah, but it's not necessary to use MicroPython. Having so many libraries compatible with the Arduino core make it so popular
tzapu
@tzapu
Mar 02 2016 06:40
@AdySan you could do it like that, but at least theoretically it should be faster through http/websockets
i think igrr mentioned it at some point, together with some thoughts of streaming the interface of his rice cooker through vnc :P
bidyutper
@bidyutper
Mar 02 2016 10:35
Is there any type of relay which I can connect normal switch i,e SPST type .......any possibility circuit...can able to do SPST switching or relay switching for load.....or while load ON via relay it can be turned off by SPST switch correspondingly while load on via SPST switch it can be turned off by SPST switch....... anyone!!!
*off by relay
Stavros Korokithakis
@skorokithakis
Mar 02 2016 10:42
@bidyutper you want a switch that can override load both ways?
bidyutper
@bidyutper
Mar 02 2016 10:45
looking for switching circuit load can be control from both from relay and SPST switch
Relay may be DPDT , latching type or any other that can do this task
tzapu
@tzapu
Mar 02 2016 10:47
why not have the switch override and command the relay as well? i may be missing something..
bidyutper
@bidyutper
Mar 02 2016 10:50
want to control from conventional method as well as from controller also...if controller blown away load can be on via a switch....
yeah each should override each-others on/off switching condition...
Stavros Korokithakis
@skorokithakis
Mar 02 2016 10:54
i don't know of anything that can override both ways
so you're saying that whichever one switches the latest, that's what should be done?
bidyutper
@bidyutper
Mar 02 2016 10:58
FLO2NNUIHBVIUMS.jpg
it can be override though relay is in ON condition it can be done via SPDT two way switch....
Stavros Korokithakis
@skorokithakis
Mar 02 2016 11:00
hmm yeah, but you have a single switch, no?
bidyutper
@bidyutper
Mar 02 2016 11:00
yap
i m looking for that any circuit?
tzapu
@tzapu
Mar 02 2016 11:04
well, a latching would work, and pass low voltage power through switch to make it latch on/off
bidyutper
@bidyutper
Mar 02 2016 11:09
not gone through latching method yet, doing all possibilities circuit with DPDT relay still no success...
Stavros Korokithakis
@skorokithakis
Mar 02 2016 11:09
@bidyutper use two relays?
bidyutper
@bidyutper
Mar 02 2016 11:12
DPDT is same as two relay .....only tripping from single coil...
with separate NO NC C terminal
tzapu
@tzapu
Mar 02 2016 11:15
in my yet to be finished 220v electrical, for some lights are ve got finder relays
for lighting
which allow me to either pulse a 220v switch to turn lights on
or to have a relay that pulses the 220v for me
the relay could technically drive any mains power load within parameters
of course, being impulse driven, you don t know if it s on or off,
that would be the same as a latching relay, though
tzapu
@tzapu
Mar 02 2016 11:20
two relays like @skorokithakis suggest, like in your skematic, you could control one relay from microcontroller and one from mains switch, the downside would be that the mains swithc won t have a predictable on/off position, as they will reverse every time yyou switch it from the secondary relay
if that makes sense
bidyutper
@bidyutper
Mar 02 2016 11:23
ha ...anyone thought that SPST switch as two way switch
tzapu
@tzapu
Mar 02 2016 11:24
that s pretty much what they do in the 2 relays combination
2 2 way switches
:P
Stavros Korokithakis
@skorokithakis
Mar 02 2016 11:27
yeah, that's what i meant, use the switch to control one of the relays, like @tzapu said
bidyutper
@bidyutper
Mar 02 2016 11:29
yeah I got ur point guyz ... I m thinking of doing the same ...thx
tzapu
@tzapu
Mar 02 2016 11:32
i do hate out of sync buttons on my walls… they are like rude...
bidyutper
@bidyutper
Mar 02 2016 11:32
ha
tzapu
@tzapu
Mar 02 2016 11:33
btw, with that i don t think you can tell either if it s on or off, so maybe give the lighting relays a look
some are quite cheap
step relays, that was the term
bidyutper
@bidyutper
Mar 02 2016 11:36
I came across with this type of relay but never studied..
tzapu
@tzapu
Mar 02 2016 11:37
got about 7 of them installed
all good
electromagnetic latching one kind of noisy
electronic one, expensive
but can do dimming and stuff
bidyutper
@bidyutper
Mar 02 2016 11:37
any wiring circuit for step relay
tzapu
@tzapu
Mar 02 2016 11:38
well, you need 2 wires to switch
or even one if you work with common phase or null
i think
and of course power the load from relay
bidyutper
@bidyutper
Mar 02 2016 11:40
thats the Common terminal where my load is connected
Aditya Tannu
@AdySan
Mar 02 2016 15:18
More hack than functionality, amazing nonetheless
Holger Lembke
@holgerlembke
Mar 02 2016 15:22
Moinmoin. I have a text file and an index file to positions in that file. And I want to read chunks from that file. I do
''' // long start = 20;
// long ende = 100;
String antwort;
antwort.reserve(ende-start);

File sloganfile = SPIFFS.open((char *)filename.c_str(), "r");
sloganfile.seek(start,SeekSet);
sloganfile.read((uint8_t *)antwort.c_str(),ende-start);
sloganfile.close();
And it gives me nothing and I don't see why.... any ideas out there?
Martin Ayotte
@martinayotte
Mar 02 2016 15:26
@holgerlembke , you can not pass a String pointer to read(), you need to pass something already allocated. use char buf[128]; or something like.
Holger Lembke
@holgerlembke
Mar 02 2016 15:27
I don't pass the string, I reserve a string-buffer and then try to pass the buffer...
at least I think I do that...
Martin Ayotte
@martinayotte
Mar 02 2016 15:28
In the code above, the String antwort has an empty buffer (length = 0), so you can even end-up with a crash.
even if reserve() is used.
Holger Lembke
@holgerlembke
Mar 02 2016 15:28
antwort.reserve(ende-start);
Why?
Martin Ayotte
@martinayotte
Mar 02 2016 15:29
You better stick with something like "char buf[128];"
Holger Lembke
@holgerlembke
Mar 02 2016 15:31
I thought I could avoid moving the strings around in Memory. directly read and avoid the copy....
Martin Ayotte
@martinayotte
Mar 02 2016 15:32
Ok ! ... I've looked at WString.h, and maybe your code should work. So, I 've no idea why it doesn't ...
Still : maybe you should try char buf[] just to try to figure out
Maybe an issue with the seek() ? try without the seek ...
BTW, for the antwort.reserve(ende-start);, it needs to be antwort.reserve(ende-start + 1); since you need the string null character too.
Holger Lembke
@holgerlembke
Mar 02 2016 15:38
hmmm. tried to read the first 200 Bytes without seek, nada. empty again...
and read() does read something... gives that number of Bytes back I put in.
Martin Ayotte
@martinayotte
Mar 02 2016 15:41
I re-read WString.h again, and I think I understand now : the other members such "len" is protected, so even if you write to it buffer, the String still at length 0. So, no choice to use "char buf[]", you can't use String class directly except if you derived to your own class and add a function to write into it externally.
Hoping you understood what I mean ...
Holger Lembke
@holgerlembke
Mar 02 2016 15:46
Yes, reading the source now, too... reserve() seems only to preallocate a buffer....
Martin Ayotte
@martinayotte
Mar 02 2016 15:47
Yes, the reserve is working, your call to read() is working, but internal len still at zero, and there is no function to change it to real size after the read().
You can derived to your own class and add a setLength() function , but it is maybe a bit overkill
Holger Lembke
@holgerlembke
Mar 02 2016 15:49
... and no way to create something empty I can move my data into.
Holger Lembke
@holgerlembke
Mar 02 2016 16:08
pffff. gives a Long function. :)
But works.
Martin Ayotte
@martinayotte
Mar 02 2016 16:09
Do you mean that you wrote a derived class with a new setLength() function ?
Holger Lembke
@holgerlembke
Mar 02 2016 16:10
no. changing my read-stuff. for a good way (object Change) It would be better to have something like .setstring(lenght, character) or so
Ivan Grokhotkov
@igrr
Mar 02 2016 16:11
There is a StreamString class which might be what you need
#include <StreamString.h>
It's a Stream, and it's a String
so you can print into it, and then use it as a string
it's not portable though (we only have it in the ESP8266 core)
Holger Lembke
@holgerlembke
Mar 02 2016 16:14
sounds nice.
my idea was to make it simple and memory friendly, allocate and move it home. anyway. it works.
Martin Ayotte
@martinayotte
Mar 02 2016 16:16
Unfortunately, I don't think it fit in the context, since @holgerlembke only wish to pass the String pointer to SPIFFS.read()
Ivan Grokhotkov
@igrr
Mar 02 2016 16:17
yeah, we need something like Stream::readInto(Stream&, size_t)...
or Stream::readFrom(Stream&, size_t)
Holger Lembke
@holgerlembke
Mar 02 2016 16:18
why so specialized? just setString(..) would be enough.
Martin Ayotte
@martinayotte
Mar 02 2016 16:18
or a new FS member "String read(int size)"
Ivan Grokhotkov
@igrr
Mar 02 2016 16:21
Reading from stream into stream would be handy because WiFiClient is a Stream, and File is a Stream, and Serial is a Stream
so you can pump data between them
and with StreamString, you can pump data into strings as well
so one method covers a lot of use cases
Holger Lembke
@holgerlembke
Mar 02 2016 16:24
sounds valid.
Martin Ayotte
@martinayotte
Mar 02 2016 16:24
That would be nice !
Holger Lembke
@holgerlembke
Mar 02 2016 16:26
how random is random()?
(/me switches topic)
Ivan Grokhotkov
@igrr
Mar 02 2016 16:28
random uses hardware RNG, which is pretty good
Holger Lembke
@holgerlembke
Mar 02 2016 16:28
nice. and how to initialize? gives back the same sequenz at every start.
really? let me check
Holger Lembke
@holgerlembke
Mar 02 2016 16:30
at least in my three checks....
Ivan Grokhotkov
@igrr
Mar 02 2016 16:35
can not confirm this with the latest version
s$.lܟ<.„là|....„.lä.#|ƒ.ì.›s›#„.c„ò'oßdg'œãä.c.pÄÇdsdrdpò'à....ƒ.l.Œœ...c.oã<.l„ŒÇc„ûgnî.dŒÇ$`.Ø..'o.$`...g{’›o..‚„l ..r›Û'..ƒŒd`.üƒgœ.RNG test
673
296
25
34
975
258
266
{$.lœŸ|.Ädà|....„.lä.#|‡ƒ.ì.Ûs›b„.cÄò'oß$g'œãä.c.pŒÇds$sdpónà....ƒ.d.Œœ...c.gã|.l„ŒŽc„ò'oï.dŒŽ$`...ng.l`...'{‡“›g..ƒÄl ..s›’'..ƒŒd`.üÃgœ.RNG test
608
63
984
39
950
185
966
598
{$.lœŸ|.Ädà|....„.lä.#|‡ƒ.ì.Ûs›b„.#Äònoß$gnœãì.c.pìÇds$sdpû'à....ƒ.l.Œœ...c.oâ<.l„ÄǏc„ûgnç.dÄÇd`.Ø..'o.d`...gs’“o..‚„l`..r“Ûg..ƒŒl`.üƒgœ.RNG test
219
685
836
808
229
871
652
{l.lœŸ|.Œdà|....Ä.dì.c<ǃ.ä.’{ÛcÄ.bŒóogŸl'oÜãì.#.pì${ls$xónà....ƒ.d.Œœ...c.gã|.lȎ‡cÄò'oï.$ŒŽl`...og.l ...n{‡“›g..ƒÄl`..s›“n..ƒŒd`.üÃgœ.RNG test
87
92
300
12
170
824
656
357
980
Garbage lines come when I reset the chip
Stavros Korokithakis
@skorokithakis
Mar 02 2016 16:35
i get that always
i mean i always get garbage at reset
Ivan Grokhotkov
@igrr
Mar 02 2016 16:36
void setup() {
  Serial.begin(115200);
  Serial.println("RNG test");
  delay(1000);
}

void loop() {
  Serial.println(random(1000));
  delay(500);
}
Holger Lembke
@holgerlembke
Mar 02 2016 16:36
This message was deleted
Ivan Grokhotkov
@igrr
Mar 02 2016 16:36
@holgerlembke so it looks like it is pretty random here
Holger Lembke
@holgerlembke
Mar 02 2016 16:36
Serial.println(random(10));
Serial.println(random(10));
Serial.println(random(10));
delivers 3 3 2
Ivan Grokhotkov
@igrr
Mar 02 2016 16:37
{$.lœŸ|.„dà|....„.lä.#|‡ƒ.ì.Ûs›b„.cÄò'oß$g'œãä.c.pŒÇdsdsdxónà....ƒ.d.Œœ...c.gã|.lȎ‡cÄò'oï.$Œl ...og.l ...n{‡“›g..ƒÄl`..s›“n...d`.üÃ'œ.RNG test
4
1
4
{l.lœŸ|.Ädà|....Ä.dì.b<‡ƒ.ì.’sÛcÄ.#Œóogžlgoœãì.c.pìŽ${ls$pûgà....ƒ.l.ŒÜ...c.oâ|.lŒÄ‡ŽcŒûg'ç.lćd`.Ø..'o.d`...gsÛ“o...$`..;“›g..ƒÄl`.üƒoÜ.RNG test
4
4
0
sd.$ܟ<.„là<....Œ.lä.c|‚.ì.›r›#Œ.c„ûgoŸdogœâä.c.8ćdsdrlpûgà....ƒ.l.ŒÜ...c.nâ|.lŒÄ‡ŽcŒûg'ç.lćd`.˜..'o.d`...gsÛ“o...$`..;“›g..ƒÄl`.üƒoÜ.RNG test
8
0
6
;l.dœß|.Œ$à|....Ä.dì.c<ǃ.ä.“{’cÄ.bŒóogŸl'oÜãì.#.xìl{l{$pò'à....ƒ.l.Œœ...c.oã<.l„ŒÇc„ûgoî.dŒÇ$`...no.$`...'{’›o..ƒ„l ..s›Û'..ƒŒd`.üƒgœ.RNG test
8
5
4
{l.lœŸ|.Ädà|....„.dä.b<‡ƒ.ì.’sÛcÄ.#Œóngžlgnœãì.c.pŒŽ${$sdpûgà....ƒ.l.ŒÜ...c.oâ|.lŒÄ‡c„ûgnç.dćd`.Ø..'o.d`...gsÛ“o...$`..r“Ûg..ƒÄl`.üƒoÜ.RNG test
5
8
8
Holger Lembke
@holgerlembke
Mar 02 2016 16:39
This message was deleted
RNG test
933
743
262
529
700
508
752
256
Keyboard hates me.
Ivan Grokhotkov
@igrr
Mar 02 2016 16:40
you need backticks, ` not '
and three backticks at the and as well
:+1:
Holger Lembke
@holgerlembke
Mar 02 2016 16:41
repeatable. after reset, always the same...
Ivan Grokhotkov
@igrr
Mar 02 2016 16:42
which version is this?
2.1.0?
Holger Lembke
@holgerlembke
Mar 02 2016 16:42
2.1.0-rc2
Ivan Grokhotkov
@igrr
Mar 02 2016 16:44
There was a recent change, esp8266/Arduino@bf067f7
You need to get 2.1.0 or git version
Stavros Korokithakis
@skorokithakis
Mar 02 2016 16:45
what's the issue we're talking about? the junk or the randomness?
Ivan Grokhotkov
@igrr
Mar 02 2016 16:47
the non-randomness @holgerlembke is observing
Stavros Korokithakis
@skorokithakis
Mar 02 2016 16:47
ah right
i don't see it :(
i don't see repeated numbers
Ivan Grokhotkov
@igrr
Mar 02 2016 16:48
according to @holgerlembke they repeat between resets
as they should, because he is using an older version of the core which didn't utilize hardware RNG
Holger Lembke
@holgerlembke
Mar 02 2016 16:48
they do.... :=
Stavros Korokithakis
@skorokithakis
Mar 02 2016 16:49
ah hmm
Ivan Grokhotkov
@igrr
Mar 02 2016 16:49
Here's the commit: esp8266/Arduino@bf067f7
Stavros Korokithakis
@skorokithakis
Mar 02 2016 16:49
right, i was looking at your messages, @igrr, sorry
Ivan Grokhotkov
@igrr
Mar 02 2016 16:50
actually it's kinda funny because you can no longer generate repeatable sequences of pseudo-random numbers by calling randomSeed...
Holger Lembke
@holgerlembke
Mar 02 2016 16:51
so I will ignore it and wait for the next release....
Ivan Grokhotkov
@igrr
Mar 02 2016 16:52
the release is already there, it's 2.1.0 :)
no need to wait for it
Holger Lembke
@holgerlembke
Mar 02 2016 16:53
hm. my board Manager does not show...
Ivan Grokhotkov
@igrr
Mar 02 2016 16:53
it's on the stable channel
unfortunately due to the way Arduino IDE deals with core versions, we can not deliver the same version both to stable and staging channels
Holger Lembke
@holgerlembke
Mar 02 2016 16:54
i see now.
Holger Lembke
@holgerlembke
Mar 02 2016 17:00
next more difficult Thing: I want to create an Access Point and have an webserver answer to any request to any ip from the Client. some sort of stupid Setup for stupid pll. they shall be able to enter anything in their browser and always land on my page... I didn't look into it, any suggestions?
Ivan Grokhotkov
@igrr
Mar 02 2016 17:02
Check out CaptivePortal example in the DNSServer library
Holger Lembke
@holgerlembke
Mar 02 2016 17:04
This message was deleted
Oh, CaptivePortal look very easy.
holgerlembke @holgerlembke should go to bed.
Holger Lembke
@holgerlembke
Mar 02 2016 17:08
"Uploading files to file System" at https://github.com/esp8266/Arduino/blob/master/doc/filesystem.md should get a note that the board must be switched in upload mode. otherwise the data uploader won't work.
the very detailed list suggests that this step is not necessary.
Holger Lembke
@holgerlembke
Mar 02 2016 17:14
drucker.jpg
Stavros Korokithakis
@skorokithakis
Mar 02 2016 17:17
haha, is that a thermal printer driven by an esp?
Markus
@Links2004
Mar 02 2016 17:19
@holgerlembke nice reuse of old technology.
Holger Lembke
@holgerlembke
Mar 02 2016 17:19
yepp. 10 € from ebay
Stavros Korokithakis
@skorokithakis
Mar 02 2016 17:20
how did you hook it up?
Holger Lembke
@holgerlembke
Mar 02 2016 17:22
74hc595 for data bits, busy + strobe directly
(clamping busy to 3.3v and strobe just works)
Stavros Korokithakis
@skorokithakis
Mar 02 2016 17:23
hmm, i don't know what those are
Holger Lembke
@holgerlembke
Mar 02 2016 17:24
those whats?
Stavros Korokithakis
@skorokithakis
Mar 02 2016 17:25
busy and strobe
Holger Lembke
@holgerlembke
Mar 02 2016 17:26
strobe comes from esp and says "data bits are ready" and busy comes from printer and says "I'm busy, please wait."
so: wait for not busy, set data bits, set strobe, wait some moment, unset strobe, rinse repeat.
Martin Ayotte
@martinayotte
Mar 02 2016 17:27
@skorokithakis the 74HC595 is a register where data is pushed in with a clock called "strobe". I personally prefer real GPIO expander such MC23017
Stavros Korokithakis
@skorokithakis
Mar 02 2016 17:28
oh, i see
so the printer reads the register and prints the character?
Holger Lembke
@holgerlembke
Mar 02 2016 17:29
drucker2.jpg
(work in progress or never...)
Markus
@Links2004
Mar 02 2016 17:30
@skorokithakis the printer has a Parallel port like interface
Stavros Korokithakis
@skorokithakis
Mar 02 2016 17:32
oh
so the ESP connects to that?
i thought you replaced the guts with the ESP, rather than having it "external"
Holger Lembke
@holgerlembke
Mar 02 2016 17:34
no, the Printer is not really worth that much Energie.
Stavros Korokithakis
@skorokithakis
Mar 02 2016 17:34
right
pretty cool though
Markus
@Links2004
Mar 02 2016 17:35
@holgerlembke is not doing it ;) for me its looks like he use a ESP8266 instead of a PC with LPT (Parallel port).
may its possible to use the same way to control some old needle printer ;)
Stavros Korokithakis
@skorokithakis
Mar 02 2016 17:35
hmm, are parallel ports powered?
Holger Lembke
@holgerlembke
Mar 02 2016 17:36
yeap. and a very simple lpt-object so lpt.print works.
Michael Miller
@Makuna
Mar 02 2016 17:36
@igrr Having set the seed to the same thing for random but then having it not return the same values is a compatibility problem. This technique is used for gaming (random level but restart gives the same random level).
Stavros Korokithakis
@skorokithakis
Mar 02 2016 17:37
would be nice to make a cheap device that's just a parallel port with an embedded ESP inside
holgerlembke @holgerlembke must be on hackaday once before I die.
Stavros Korokithakis
@skorokithakis
Mar 02 2016 17:37
you stick it on the printer, and it gets wifi-enabled
@holgerlembke that's not that hard, this printer would definitely go on there :smile:
Ivan Grokhotkov
@igrr
Mar 02 2016 17:38
@Makuna i noticed that as well, and was going to write the same comment for @Links2004 :) However even if we don't alter the seed, and if we are using hardware RNG, we won't get reproducible values anyway.
Holger Lembke
@holgerlembke
Mar 02 2016 17:39
@igrr i could lend some Code that does... :)
Ivan Grokhotkov
@igrr
Mar 02 2016 17:40
So actually we should use either software PRNG, or we should use hardware PRNG... the trouble is that we need to make one of them the default
Having software PRNG the default one is good for compatibility
Having hardware PRNG the default one is good for security
it's not an easy choice :)
Holger Lembke
@holgerlembke
Mar 02 2016 17:40
why? just turn off the Hardware prng after a call to randomseed()
Michael Miller
@Makuna
Mar 02 2016 17:41
Is there way to make it configurable? As holgerlembke just stated ;-)
Ivan Grokhotkov
@igrr
Mar 02 2016 17:41
There may be legacy code which does randomSeed(analogRead(A0)) in an attempt to get good random numbers
Markus
@Links2004
Mar 02 2016 17:42
i vote for more security as default, if some one need not so random, random number we can provide a parameter or other function for it.
Holger Lembke
@holgerlembke
Mar 02 2016 17:42
lol, thats what I tried some seconds ago. analoadRead(A0) gives a very stable value here....
Michael Miller
@Makuna
Mar 02 2016 17:42
Yes, I actually have something like this in most of my examples in my libraries (with a better method to randomize off A0). So I am spreading that problem.
Stavros Korokithakis
@skorokithakis
Mar 02 2016 17:42
@igrr use the hardware RNG to seed the software one with a long seed at startup?
Holger Lembke
@holgerlembke
Mar 02 2016 17:43
I randoize with millis() after WIFI Login.
Stavros Korokithakis
@skorokithakis
Mar 02 2016 17:43
then, reseeding will work correctly, and the RNG should still be random enough
Michael Miller
@Makuna
Mar 02 2016 17:43
@holgerlembke The read off A0 only has two bits at the bottom, you need to shove it upward, look at GitHub/Makuna/RandomSeed
Ivan Grokhotkov
@igrr
Mar 02 2016 17:43
@skorokithakis software prng is really really crappy compared to the hardware one
Stavros Korokithakis
@skorokithakis
Mar 02 2016 17:43
oh :(
have a separate interface for the sw RNG?
i think the HW RNG should definitely be the default
you don't want bad randomness in general
Michael Miller
@Makuna
Mar 02 2016 17:44
NO
Comaptibility states it needs to act like ARduino.
Stavros Korokithakis
@skorokithakis
Mar 02 2016 17:44
how is that?
Ivan Grokhotkov
@igrr
Mar 02 2016 17:45
if you call randomSeed(0) in the beginning of your sketch, it should give identical values on each run
that's how an Arduino behaves
Holger Lembke
@holgerlembke
Mar 02 2016 17:45
@Makuna a0 floating around but analogRead(A0) gives "30" for a very Long time at my current esp.
Stavros Korokithakis
@skorokithakis
Mar 02 2016 17:45
@igrr hmm, then have the SW RNG be the default, and add hwRNG functions?
Michael Miller
@Makuna
Mar 02 2016 17:46
If we change to far off from Arduino standards we cause problems for users. We need an easy way to switch from Software to Hardware and have a SecureRandom, for those that really care.
@holgerlembke Put a wire on A0 of about two cm long ;-)
Holger Lembke
@holgerlembke
Mar 02 2016 17:46
yeah!
Ivan Grokhotkov
@igrr
Mar 02 2016 17:47
how about setRandom(PRNG_SOFTWARE) and setRandom(PRNG_HARDWARE)?
Stavros Korokithakis
@skorokithakis
Mar 02 2016 17:47
@igrr that's a bit too complex, i think
Ivan Grokhotkov
@igrr
Mar 02 2016 17:47
PRNG_HARDWARE is the default, unless randomSeed() was called
Markus
@Links2004
Mar 02 2016 17:47
long realRandom(long howbig) 
    return (RANDOM_REG32) % howbig;
}
Stavros Korokithakis
@skorokithakis
Mar 02 2016 17:47
@igrr yes
@igrr i like that a lot
Ivan Grokhotkov
@igrr
Mar 02 2016 17:47
@Links2004 this won't be used by libraries...
Markus
@Links2004
Mar 02 2016 17:48
yes, true.
Ivan Grokhotkov
@igrr
Mar 02 2016 17:48
We just need to keep the original API so that the code which called random() will have a chance to get better random values
Michael Miller
@Makuna
Mar 02 2016 17:49
@igrr Yes, we need something that someone doesn't have change to use a new API to create a compatible Library, but allows the Sketch to switch it (or library to switch if they care if #ifdef ESP
Markus
@Links2004
Mar 02 2016 17:49
some other problem, most library that use random also use randomSeed inside.
Ivan Grokhotkov
@igrr
Mar 02 2016 17:49
I'll probably open an issue for a discussion.
Michael Miller
@Makuna
Mar 02 2016 17:50
Seed planted, thoughts growing, pun intended ;-)
I really wish Arduino would include a new encryption level random in the core.
@igrr What version of the SDK is the latest release using?
Holger Lembke
@holgerlembke
Mar 02 2016 17:59
the MC23017 DIP is larger than the entire printer....
Stavros Korokithakis
@skorokithakis
Mar 02 2016 18:00
@igrr can you cc me in the issue, or mention me here? i'd like to chim ein
Martin Ayotte
@martinayotte
Mar 02 2016 18:07
@holgerlembke , the MCP23017 has 16 GPIOs, there is the MCP23008 which has 8, or the PCF8574 too. But, anyway, no need to change your design if it is already working. Simply that I've stated my preferences beacause GPIOs can be switch to input or output, while HC595 is output only.
Holger Lembke
@holgerlembke
Mar 02 2016 18:14
too late. I bought some
Martin Ayotte
@martinayotte
Mar 02 2016 18:17
some HC595 or some MCP23017 ?
Ivan Grokhotkov
@igrr
Mar 02 2016 18:24
anyone here has experience with software USB on AVRs?
I'm thinking about adding a software USB driver with mass storage function to the eboot bootloader
so that you can "upload" new firmware to the ESP "removable drive" in a way similar to mbed
Aditya Tannu
@AdySan
Mar 02 2016 18:26
looking forward to that, kinda like the DigiSpark bootloader
that's actually not a mass storage
not much mass on the ATtiny
but with ESP it makes sense
Holger Lembke
@holgerlembke
Mar 02 2016 18:28
@martinayotte mcp23017. so many nice parts out there...
Martin Ayotte
@martinayotte
Mar 02 2016 18:29
I've played a bit with V-USB on ATtiny2313, but not as mass storage.
@igrr , but V-USB is timing critical, could be a problem while WiFi thread is working.
Ivan Grokhotkov
@igrr
Mar 02 2016 18:30
that's why i want it to run only in bootloader
i.e. you press "flash" button on your device and plug it into the pc
Martin Ayotte
@martinayotte
Mar 02 2016 18:30
Ah ! Ok !
You can take a look at https://forums.obdev.at/viewforum.php
Ivan Grokhotkov
@igrr
Mar 02 2016 18:32
I've just found a russian blog which explains the use of v-usb to create an MSD
oh, wow, turns out my saleae logic pro can decode USB LS and FS.
igrr @igrr leaves for a while
Martin Ayotte
@martinayotte
Mar 02 2016 18:38
Interesting !
Markus
@Links2004
Mar 02 2016 18:48
@igrr have used v-usb a while ago on avr.
I where thinking of a port for ESP last year, but skipped it after seeing how many timer and AVR dependent hardware register they use and the point it will not really work with running WiFi.
but using it for boot loading is a great idea.
Aditya Tannu
@AdySan
Mar 02 2016 18:52
The way DigiSpark bootoader avoids having to press a button, is it waits for the first 5 seconds for a usb connection. So every time you flash, you actually have to replug the device. Annoying but that's another approach.
Also the 5 sec wait can be turned off by pulling down a GPIO
Ivan Grokhotkov
@igrr
Mar 02 2016 19:36
@Links2004 yeah after looking through v-usb source i think it will be a pretty big effort to port. This one on the other hand is much more manageable: https://github.com/lemcu/LemcUSB
Me No Dev
@me-no-dev
Mar 02 2016 19:37
v-usb is not at all possible on ESP with WiFi on
else it can be done
but what would you need an ESP without WiFi
Ivan Grokhotkov
@igrr
Mar 02 2016 19:37
True, but i'm looking at bootloader application — wifi doesn't need to be on
Me No Dev
@me-no-dev
Mar 02 2016 19:37
then it's doable
not a big deal actually
Ivan Grokhotkov
@igrr
Mar 02 2016 19:37
i.e. plug in your device and drag&drop new firmware on the MSD
Me No Dev
@me-no-dev
Mar 02 2016 19:38
it's hard on AVR cuz it's slow
have not looked at MSD per say but have implemented about any other basic device through v-usb
as far as I know the MSD capable devices have actuall USB hardware that permits larger buffers to be transmitted
with v-usb it's 8 bytes every 1ms at most
Ivan Grokhotkov
@igrr
Mar 02 2016 19:40
i've seen people implement MSD with v usb on AVR, so i think it's not a big deal as well.
Me No Dev
@me-no-dev
Mar 02 2016 19:40
so 7 kbytes a second... not much
on 32k m328p it's ok for bootloader
but sending 300k or more over that slow connection :)
Angus Gratton
@projectgus
Mar 02 2016 21:26
igrr: my understanding was that mass storage requires bulk transfer endpoints, and low speed usb can't do bulk transfer endpoints
so you'd need to be able to bit bang full speed USB (12mbps)
I'm curious to see how you go, though :)
actually maybe I'm wrong, section 8.5.2 of USB 2.0 spec seems to imply there's a control flow for bulk transfers on low speed endpoints
Ivan Grokhotkov
@igrr
Mar 02 2016 21:30
you're right, apparently the article i have linked above mentions that this only works on Windows XP, which doesn't check that MSD device should be FS or HS
Angus Gratton
@projectgus
Mar 02 2016 21:32
oh no, section 5.8.3 - A low-speed device must
not have bulk endpoints.
"
ah, good old XP :)
Angus Gratton
@projectgus
Mar 02 2016 21:37
I was wondering about the possibility for bit banging low speed USB even with WiFi turned on
because USB hosts are super resilient, you can reasonably rely on the host to retry transactions if NMI occurs during a USB transaction
so it'd be slower than slow, and resource inefficient, but it might actually work
Me No Dev
@me-no-dev
Mar 02 2016 22:35
bulk endpoints are possible but they are limited to 8 bytes
and I hav not been able to make them larger
but have run a full Serial implementation with 3 endpoints and all
the bitbang with WiFi will not work because the timing is really tight
if you for example miss the start of the transmission, then you will not be able to get the data correctly
surely can be attempted
Angus Gratton
@projectgus
Mar 02 2016 22:40
me-no-dev: interesting (re bulk eps), I guess it works even though it violates the standard.
Me No Dev
@me-no-dev
Mar 02 2016 22:41
yup :) many violations work
the above serial one stopped working on OSX on ElCapitan
but again they are really limited and I have not been able to pull more often than every ms
Angus Gratton
@projectgus
Mar 02 2016 22:42
are you talking about on esp8266, or using something like vusb on avr?
Me No Dev
@me-no-dev
Mar 02 2016 22:42
so 8000 bytes max a second
no I'm talking v-usb
but it will be the same
I doubt we can bitbang 12MHz
Angus Gratton
@projectgus
Mar 02 2016 22:43
i understand the theory is the same, just curious if anyone has made it work
Me No Dev
@me-no-dev
Mar 02 2016 22:43
I think it's protocol limitation of some sort on the computers
even if I set the bulk to be 64 bytes let's say
it does not let me send more than 8
or better said it does not receive them
Angus Gratton
@projectgus
Mar 02 2016 22:45
hmm
my point with WiFi/NMI timing is that on NAK or bad CRC, the host will wait a while and retry. so eventually (probably) you'd get a valid transaction, it just might take a while. i don't know how long "a while" is or how long it would take before the host controller returned a failure to the OS, but it might be enough.
Me No Dev
@me-no-dev
Mar 02 2016 22:47
I think the biggest problem is that you might get interrupt in the middle of some wifi work and the esp will go to hell
not so much the USB part
Angus Gratton
@projectgus
Mar 02 2016 22:47
hmm ok
Me No Dev
@me-no-dev
Mar 02 2016 22:47
the interrupt routine will take some time to read the request and eventually reply if there is data to be sent
and I think that will screw the flaky network
Angus Gratton
@projectgus
Mar 02 2016 22:48
true. I only know about the internals we have on esp-open-rtos, not the SDK you use in arduino. but in esp-open-rtos it'd probably be OK to block in a gpio interrupt handler
because the NMI can preempt that, and at least on our libraries you can block normal interrupts without permanent consequences, you just can't block the HNMI
*NMI
Me No Dev
@me-no-dev
Mar 02 2016 22:49
rtos is much more forgiving I have seen
Angus Gratton
@projectgus
Mar 02 2016 22:49
maybe different on Arduino / Espressif IoT SDK
fair enough
Me No Dev
@me-no-dev
Mar 02 2016 22:50
for example the same framework on rtos (ESP31B) is much much more stable