These are chat archives for esp8266/Arduino

20th
Jun 2018
den har
@denman0000_gitlab
Jun 20 2018 00:00
@devyte coolio
@devyte ..perhaps you could help with a few simple questions that are driving me loco
@devyte they aren't code but are design related
den har
@denman0000_gitlab
Jun 20 2018 00:09
@devyte hehe or not :-)
Develo
@devyte
Jun 20 2018 03:36
aight, as long as I'm around, shoot
Chris Dalby
@moose4621
Jun 20 2018 09:05
@denman0000_gitlab You there mate?
Chris Dalby
@moose4621
Jun 20 2018 09:32
@devyte Thanks for your help earlier today. I tried your first suggestion for the payload array casting and it works great. I was hoping you could tell me why console is now reporting to be 3 or 4 arrays being sent over websockets.
ArrayBuffer(4) {} [[Int8Array]] : Int8Array(4) [42, 0, 53, 0] [[Int16Array]] : Int16Array(2) [42, 53] [[Int32Array]] : Int32Array [3473450] [[Uint8Array]] : Uint8Array(4) [42, 0, 53, 0] byteLength : (...)
@devyte or is it the same array being read 4 different ways?
den har
@denman0000_gitlab
Jun 20 2018 11:25
@moose4621 hello how are you ?
@moose4621 @devyte @ashthespy Hello there
Hello all actually :-)
anyone around ?
Chris Dalby
@moose4621
Jun 20 2018 11:28
@denman0000_gitlab Howdy.
den har
@denman0000_gitlab
Jun 20 2018 11:29
@moose4621 Howdy howdy ...How are you ? :-)
Chris Dalby
@moose4621
Jun 20 2018 11:29
@denman0000_gitlab Great, and you?
den har
@denman0000_gitlab
Jun 20 2018 11:30
@moose4621 glad you're well and I'm great too :-)
@moose4621 I think I found part of what I was looking for .. Its a very basic example but shows how to get the variables across
Chris Dalby
@moose4621
Jun 20 2018 11:31
@denman0000_gitlab Awesome. That's got to make you feel better.
den har
@denman0000_gitlab
Jun 20 2018 11:31
@moose4621 only things is it seems to print the output on the console a number of times .. can't seem to see why
@moose4621 ...LOL one would think , sadly the closer I seem to think I am the further away I seem to feel ..if that makes sense
@moose4621 I was thinking about all last night and looking at the original arduino code I have .. and hopefully have now broken down the steps,
Chris Dalby
@moose4621
Jun 20 2018 11:38
@denman0000_gitlab Hmm, nothing jumps out at me yet.
den har
@denman0000_gitlab
Jun 20 2018 11:41
@moose4621 ... The order is as follows :
1.read a file from spiffs to populate a table on Webpage as well as an array on the C++/arduino side.
  1. If a row is added grab the data from input fields and update the table .
  2. get that row info into variables and populate array
    (at same time write the array field to a file on spiffs) .
@moose4621 sorry steps are 1,2,3 lol something weird in formatting here
@moose4621 currently that code returns multiple entries in the serial console when you click save only once :-( see here :
Hours: 12
Minutes: 01
Seconds: 27
This is server arg: 12
Hours: 12
Minutes: 01
Seconds: 27
This is server arg: 12
Hours: 12
Minutes: 01
Seconds: 27
This is server arg: 12
Hours: 12
Minutes: 01
Seconds: 27
Chris Dalby
@moose4621
Jun 20 2018 11:50
@denman0000_gitlab Nope, still cannot see where the problem is. Still looking.
den har
@denman0000_gitlab
Jun 20 2018 11:53
@moose4621 maybe its here : $.get('/save?hh=' + hh + '&mm=' + mm + '&ss=' + ss, function(data){\
I cant quite get whats happening there
Develo
@devyte
Jun 20 2018 16:09
@moose4621 sorry, I'm not much of a js guy, and for my simple needs I use basic js, not jquery or whatever. I need stand-alone apps that don't depend on externally hosted libs
If you have C/C++ questions, I can try to answer
den har
@denman0000_gitlab
Jun 20 2018 19:30
@devyte Ty man much appreciated
Hi all anyone here ?
Develo
@devyte
Jun 20 2018 19:32
still around
den har
@denman0000_gitlab
Jun 20 2018 19:33
@devyte cool how you doing ?
Develo
@devyte
Jun 20 2018 19:33
about to start another round of repo issue cleanup
how about you?
den har
@denman0000_gitlab
Jun 20 2018 19:34
You're keeing busy hey :-)
I'm still trying to figure out how to put all the pieces together but starting to confuse myself
one big burning questions I have is how to make a file on spiffs available to write to from my webpage
Develo
@devyte
Jun 20 2018 19:37
look at FSBrowser example
den har
@denman0000_gitlab
Jun 20 2018 19:37
typically when one works with a table on a web page .. you can add and remove elements
that interaction is done with a database
OR local file ....
or a file on a local or remote server (which serves the file )
Develo
@devyte
Jun 20 2018 19:38
I use something based on FSBrowserNG tied into the async webserver
den har
@denman0000_gitlab
Jun 20 2018 19:39
I havelooked at the FSBrowser example.. which makes perfect sense and I have it working and can add, append to a file. ..... but how to I present that file to the client
for example : url htttp://mydatafile.txt
Develo
@devyte
Jun 20 2018 19:39
there's an edit interface in there somewhere, which is essentially a text editor
I use that a lot
den har
@denman0000_gitlab
Jun 20 2018 19:40
moreover getting the path to that file ... for example http://myespIP/virtual_presented_file_path/mydatafile.txt
@devyte cool i will try find that one just now
esentialluy i just want the file to act like a database
Develo
@devyte
Jun 20 2018 19:43
there was an idea about integrating a micronized sqlite into the ESP at some point, but I never saw it implemented. I know there was something done in the lua firmware repo
den har
@denman0000_gitlab
Jun 20 2018 19:44
damn .. would have been good .. even some in memory object that works as a broker to a file would be awesome
Develo
@devyte
Jun 20 2018 19:47
why not use a json serialized to a file?
there's arduinojson as a lib
that's what I do for storing config values on SPIFFS
den har
@denman0000_gitlab
Jun 20 2018 19:47
yes i was looking at that yesterday .. just not sure what format to set it up as or how to set it up
currently my table rows look like this :
motor,outside,2018-06-18 12:00,1529316000,2018-06-19 12:00,1529402400,Normal,0001,0001
Develo
@devyte
Jun 20 2018 19:48
make up your own format. You can do an array of indexed elements, or a dict of named elements, or something that resembles a C struct
depends on your needs
den har
@denman0000_gitlab
Jun 20 2018 19:49
I understand c struct
with json the docs refer to a key value pair
Develo
@devyte
Jun 20 2018 19:49
there's key-value pair, and there's array
den har
@denman0000_gitlab
Jun 20 2018 19:50
so would motor be a key or would something like device ID be a better choice
aha re array
Develo
@devyte
Jun 20 2018 19:50
so you'd probably have a json array of elements, where each element is a json obj that has 9 key-value pairs
den har
@denman0000_gitlab
Jun 20 2018 19:50
perhaps for indexing the key value pair might be better .. not eniterly sure
@devyte ok so you saying that maybe each row in table would be an element in the array and the values for each column are the key-value pairs ?
Develo
@devyte
Jun 20 2018 19:52
look at the arduinojson examples, read their doc page, they have a ton of examples
den har
@denman0000_gitlab
Jun 20 2018 19:52
wondering how it might look
Develo
@devyte
Jun 20 2018 19:52
yes, exactly
den har
@denman0000_gitlab
Jun 20 2018 19:53
ok will head back there again .. was reading through it last night and was just getting to be information overload again
lol
feeling quite bamboozled
den har
@denman0000_gitlab
Jun 20 2018 20:01
@devyte thank you kindly for the advice
Develo
@devyte
Jun 20 2018 20:05
NP, and research more. That's the nature of developing in such systems: you need to investigate a whole lot, and figure out how to put all the pieces together.
BTW, I strongly suggest keeping your SPIFFS files small: small html, small js files, small css, etc. where small means few KB. I do NOT recommend implementing one huge html with embedded html/js/css, and certainly not html/js/css embedded in your C/C++ app code
den har
@denman0000_gitlab
Jun 20 2018 20:26
@devyte ... plan is to keep files tiny and minified
i think even using the json library might be excess bloat as i was previously on the arduino using in memory only as structs and arrays
would actually prefer to just keep it that way but need the spiffs/SD part to store the events data and state
after a power failure data must be read back into the relevant array(s)
Chris Dalby
@moose4621
Jun 20 2018 21:03
@denman0000_gitlab Sorry but I fell asleep again! Big days at work are too much for this old dog apparently.
@denman0000_gitlab You can have a local json library stored on spiffs or embedded. It doesn't have to be remotely accessed.
den har
@denman0000_gitlab
Jun 20 2018 21:15
@moose4621 ...Thank you soo much and ditto .. also happy to help you
@moose4621 ..you need sleep my friend .. make sure you get it
@moose4621 will catch up when you're well rested .. :)_
Chris Dalby
@moose4621
Jun 20 2018 21:17
@denman0000_gitlab Reading the arduinojson library, looks to me like just what you need.
Ash
@ashthespy
Jun 20 2018 21:18
@moose4621 -- did you crack the array?, @denman0000_gitlab evening!
Chris Dalby
@moose4621
Jun 20 2018 21:18
@denman0000_gitlab Ha ha thanks, early morning hereand is me most productive in the 'puter.
@ashthespy Yes thanks Ash. I have a working version. But.... I was wondering why I now see what appears to be 4 arrays in the console. Or is it one array being read 4 ways?
Ash
@ashthespy
Jun 20 2018 21:28
depends on how you are dumping it out in the console!
Chris Dalby
@moose4621
Jun 20 2018 21:46
@ashthespy connection.onmessage = function (e) { console.log('Server: ', e.data);
Ash
@ashthespy
Jun 20 2018 21:48
What happened to the typed arrays? ;-)
Chris Dalby
@moose4621
Jun 20 2018 21:56
@ashthespy
if(event.data instanceof ArrayBuffer ){ var buffer = new Uint8Array(event.data);
@ashthespy @denman0000_gitlab Off to work again. :-(
Ash
@ashthespy
Jun 20 2018 21:59
print out buffer and not e.data :-)
den har
@denman0000_gitlab
Jun 20 2018 22:45
@moose4621 yes seems so re JSON ...
I read somewhere its a good idea to rather create static tables than dynamic ones
can anyone confirm ?
@ashthespy Howdy Ash .. hope all's well with you :-)
den har
@denman0000_gitlab
Jun 20 2018 23:05
@skorokithakis yassu re tikanis ?
hi all has anyone played around with measuring dc voltages with ESP ? was just wondering what resistor sizes to use .. read somewhere that the ESP pin is 1,0 v max ?
den har
@denman0000_gitlab
Jun 20 2018 23:15
This is what I was reading as a start