These are chat archives for esp8266/Arduino

20th
Aug 2015
Stoian Ivanov
@sdrsdr
Aug 20 2015 07:04
Good morning :)
Stoian Ivanov
@sdrsdr
Aug 20 2015 11:14
is there any hope on merging esp8266/Arduino#709 as is?
Ivan Grokhotkov
@igrr
Aug 20 2015 11:45
How about renaming connectex into connectAsync and adding an example sketch which demonstrates how to use these new functions?
at least add a sketch which uses these functions into tests folder
Stoian Ivanov
@sdrsdr
Aug 20 2015 12:24
connectAsync should have two parameters of 3? Shall I duplicated the code in connect?
I'll see about the example :)
Ivan Grokhotkov
@igrr
Aug 20 2015 12:25
two
see if you can avoid code duplication...
Neil Kolban
@nkolban
Aug 20 2015 13:41
I'm pretty new to open source collaboration .. I work for a big computer company and we have strict documentation practices so that when I get hit by a bus, someone can follow on from me. I'd like to suggest that we take some time and make sure that we adequately document (via comments) the description of functions and any non-obvious interactions and algorithms? ...
Stoian Ivanov
@sdrsdr
Aug 20 2015 13:53
Speaking of this .. is there some docu on FS.h?
also .. is there a way to truncate file to size?
Neil Kolban
@nkolban
Aug 20 2015 13:55

Here is what I have been working on for early docs of SPIFFS

SPIFFS
FS is the File System library which provides the ability to read and write files from within the Arduino ESP environment. But wait … read and write files to where? There are no "drives" on an ESP8266. The data for the files is read and written to an area of flash memory and since flash is relatively small in size (4MBytes or so max) then that is an upper bound of maximum size of the cumulative files … however, this is still more than enough for many usage patterns such as saving state, logs or configuration information.
SPIFFS.begin
Begin working with the SPIFFS file system.
bool begin()
Returns true of success and false otherwise.

SPIFFS.open
Open the named file.
File open(const char path, const char mode)
File open(const String &path, const char *mode)
The mode defines how we wish to access the file. The options are:
r – Read the file. The file must exist.
w – Write to the file. Truncate the file if it exists.
a – Append to the file.
r+ – Read and write the file.
w+ – Read and write the file.
a+ – Read and write the file.
See also:
File.close

SPIFFS.openDir
Open a directory.
Dir openDir(const char *path)
Dir openDir(const String &path)

SPIFFS.remove
Remove/delete a file from the file system.
bool remove(const char *path)
bool remove(const String &path)

SPIFFS.rename
Rename a file.
bool rename(const char pathFrom, const char pathTo)
bool rename(const String &pathFrom, const String &pathTo)
File.available
Return the number of bytes that are available within the file from the current file position to its maximum size.
int available()

File.close
Close a previously opened file.
void close()
No further reading nor writing should be attempted to be performed.

File.flush
Flush the file.
void flush()

File.name
Retrieve the name of the file.
const char *name()

File.peek
Peek at the next byte of data in the file without consuming it.
int peek()

File.position
Retrieve the current file pointer position.
size_t position()

File.read
Read data from the file.
int read()
size_t read(uint8_t *buf, size_t size)
Read either a single byte of data or a buffer of data from the file.

File.seek
Change the current file pointer position.
bool seek(uint32_t pos, SeekMode mode)
The mode can be one of:
SeekSet – Change the file pointer position to the absolute value.
SeekCur – Change the file pointer position to be relative to the current position.
SeekEnd – Change the file pointer position to be relative to the end of the file.
File.size
Retrieve the maximum size of the file.
size_t size()

File.write
Write data to the file.
size_t write(uint8_t c)
size_t write(uint8_t *buf, size_t size)
Write either a single byte or a buffer of bytes into the file at the current file pointer position.

Dir.fileName
Retrieve the name of the file.
String fileName()

Dir.next
bool next()
Dir.open
File open(const char mode)
File open(String &path, const char
mode)
Dir.openDir
Dir openDir(const char *path)
Dir openDir(String &path)
Dir.remove
Dir.rename

regarding file truncation — no i haven't done this yet
what's the equivalent C api for this?
Stoian Ivanov
@sdrsdr
Aug 20 2015 13:58
truncate?
:)
Also no clear way to test for file existence ..
Me No Dev
@me-no-dev
Aug 20 2015 14:05
you can list the root directory and filter for the file
SPIFFS supports only root directory
Ivan Grokhotkov
@igrr
Aug 20 2015 14:05
try to open the file in "r" mode and see check the result
File f = SPIFFS.open(name, "r");
if (f) {

}
Me No Dev
@me-no-dev
Aug 20 2015 14:07
@igrr what block size are you using in SPIFFS?
Ivan Grokhotkov
@igrr
Aug 20 2015 14:07
SPIFFS doesn't have truncate function in it's API, so...
i think i haven't touched those definitions after you made the linker script variants
Me No Dev
@me-no-dev
Aug 20 2015 14:08
and you can not really trunkate the file, what will be done is the file to be deleted and an empty one created
but when you put something in it, it will be recreated again with the data on a different space
@igrr for larger partitions we should try bigger blocks, because the driver often goes through all block headers looking for a file and it's pages
Ivan Grokhotkov
@igrr
Aug 20 2015 14:10
i'm using 4m flash now, therefore block size is 0x2000
might be good to try something larger
Me No Dev
@me-no-dev
Aug 20 2015 14:11
i remember having issues with larger blocks but I can maybe blame it on the previous FLSH driver
the SPIFFS itself should be just fine with larger blocks
Stoian Ivanov
@sdrsdr
Aug 20 2015 15:13
OMG! spiffs excepts on SPIFFS.open
Shelby Merrick
@forkineye
Aug 20 2015 18:29
Not really Arduino related (yet), but does anyone have information about UART DMA transfers?
Shelby Merrick
@forkineye
Aug 20 2015 18:40
http://bbs.espressif.com/viewtopic.php?t=48 mentions DMA, but I didn't initially see it looking at the referenced files. A quick glance though seems it may be a non-blocking FIFO driven UART? essentially DMA I guess
Me No Dev
@me-no-dev
Aug 20 2015 18:45
what they have is just using a buffer connected to the interrupts
there is no DMA in the code, nore I know of UART registers that will hook it up to the DMA
we have DMA for the I2S, but not for UART
Shelby Merrick
@forkineye
Aug 20 2015 18:49
looking for away to offload ws2811 pixel stream generation. i've seen the I2S stuff, but my board is already laid out and was hoping I could offload to GPIO2 / UART TX
Me No Dev
@me-no-dev
Aug 20 2015 18:49
uart is no good in this case because it's too slow
that is why you saw an I2S implementation
it's fast as SPI and had DMA
SPI can also be used
Shelby Merrick
@forkineye
Aug 20 2015 18:51
i haven't messed with SPI yet on the ESP. will MOSI map to GPIO2?
Me No Dev
@me-no-dev
Aug 20 2015 18:52
no
Shelby Merrick
@forkineye
Aug 20 2015 18:52
hmmmm
seems i've been spoiled by the event system on my Xemgas. i could just route stuff where as needed, lol
Me No Dev
@me-no-dev
Aug 20 2015 18:53
what's theissue with @Makuna 's NeoPixel lib?
you can hook it to any pin
Shelby Merrick
@forkineye
Aug 20 2015 18:53
oh, i have pixel stream generation. just trying to keep my web config active while pulling in e1.31 data at 40Hz
Shelby Merrick
@forkineye
Aug 20 2015 19:37
I'm still brushing up on this esp8266 stuff, but from looking at that UART code, I'm thinking it may work. They claim 3686400 as a baud rate in the header.
will play around with it this weekend
Michael Miller
@Makuna
Aug 20 2015 20:03
@me-no-dev there is an issue with the latest sdk that will cause an exception if nointerrupts is used for a length of time. 200us within nointerrupts and the WiFi service being active and it fails. Again, a new deleopment with the latest sdk drop. @sticilface did the grunt work to track it down.
Me No Dev
@me-no-dev
Aug 20 2015 20:30
@Makuna does that mean that it will work for a few pixels?
I dream about the time when all of the SDK will be open
Shelby Merrick
@forkineye
Aug 20 2015 21:06
@Makuna thanks for the heads up on that!
Michael Miller
@Makuna
Aug 20 2015 21:24
@me-no-dev the shorter the time period, the less likely it is to crash, but it doesn't guarantee that it wont. What ever was done in the latest sdk is a deal stopper for bit banging.
sticilface
@sticilface
Aug 20 2015 22:01
The lower the pixels the more stable it is. The resets are proportional to the time nointurrupts
;)
Ivan Grokhotkov
@igrr
Aug 20 2015 22:03
can you enable interrupts in between the pixels?
or will it also break some timing?
brutzler
@brutzler
Aug 20 2015 22:46
Hi, is there somewhere an explanation for OTA? TIl now I have only found the example (DNS_SD_Arduino_OTA). But with more basic background, it would ne easier to understand.