Search found 401 matches

by devnull
Tue Feb 21, 2017 1:45 pm
Forum: General Discussion and Questions
Topic: ticks_diff not behaving
Replies: 5
Views: 1714

Re: ticks_diff not behaving

Turns out that the cause of this is the interrupt routine pincb().

I had to change saving the values in the interrupt so that it does not save to dictionary items.

Once I did this everything behaved as expected.
by devnull
Mon Feb 20, 2017 2:05 pm
Forum: General Discussion and Questions
Topic: ticks_diff not behaving
Replies: 5
Views: 1714

ticks_diff not behaving

Here's the output from a function that prints values every 5 seconds, it uses ticks_diff() to calculate secs, mins and hours. As you can see, it suddenly jumps from 679.43 secs to 4979.68 secs just 5 seconds later: secs: 668.86 |mins: 11.15 |hrs: 0.19 |ma: 43.53 |ma/hr: 234.28 |ma/day: 5622.73 |hrs/...
by devnull
Mon Feb 20, 2017 1:49 am
Forum: General Discussion and Questions
Topic: write to filesystem in interrupt
Replies: 2
Views: 1037

Re: write to filesystem in interrupt

@deshipu - thanks for the suggestion, but what I eventually ended up doing is calling a ONE_SHOT timer from the interrupt, it seems to work reliably and I don't need to detect it in a loop.
by devnull
Sun Feb 19, 2017 2:27 pm
Forum: General Discussion and Questions
Topic: write to filesystem in interrupt
Replies: 2
Views: 1037

write to filesystem in interrupt

I have a push-button interrupt that detects short and long presses. If long press, then I need to restart the device in setup mode, otherwise I start it in run mode. The boot.py initialises the interrupt and during startup reads a json file, if the mode in the json config is set to run then it will ...
by devnull
Fri Feb 17, 2017 12:34 pm
Forum: General Discussion and Questions
Topic: free file space
Replies: 1
Views: 957

free file space

Can someone confirm that this method is correctly calculating the available disk space ?

Code: Select all

def df(dir='/'):
	from os import statvfs
	s = statvfs(dir)
	print((s[0]*s[3]) / 1048576,'MB')
by devnull
Fri Feb 17, 2017 12:31 pm
Forum: General Discussion and Questions
Topic: file truncated in http server
Replies: 3
Views: 1354

Re: file truncated in http server

Thanks so much for helping, but I think we must have posted at the same time. Previously I was using sockets on esp32 and in that implementation send() is an alias for sendall() and so when I ported it over to esp8266 it was behaving as described. But as you suggested, changing to sendall() solved t...
by devnull
Fri Feb 17, 2017 12:09 pm
Forum: General Discussion and Questions
Topic: file truncated in http server
Replies: 3
Views: 1354

Re: file truncated in http server

OK, my apologies, after several hours, I have just solved it.

I thought that sendall() was just an alias for send() but it is not, and the solution was to use sendall() instead.
by devnull
Fri Feb 17, 2017 11:59 am
Forum: General Discussion and Questions
Topic: file truncated in http server
Replies: 3
Views: 1354

file truncated in http server

Hi; I am facing a problem whereby a file that is read is truncated while sending over a socket. It is a simple web server that replies with a file that is stored on the flash file system, it always gets truncated at 1,072 bytes/chars. If I print the file to the console instead, the entire file gets ...
by devnull
Fri Jan 20, 2017 3:53 am
Forum: General Discussion and Questions
Topic: DS18X20 rom ID lookup
Replies: 3
Views: 1477

Re: DS18X20 rom ID lookup

Dave, thanks so much for helping with this, and for such a comprehensive explanation.

That certainly works and is much more concise than the work around method I came up with

Cheers
by devnull
Tue Jan 17, 2017 5:16 am
Forum: General Discussion and Questions
Topic: DS18X20 rom ID lookup
Replies: 3
Views: 1477

DS18X20 rom ID lookup

I am attempting to associate the ROM of a DS18X20 with a dictionary so that I can identify it. First thing I noticed is that onewire.py sometimes prepends a '(' to the byte array. Second problem is I am unable to select the dictionary ds_roms using the parsed rom id. Running this on python2 succeeds...