Search found 454 matches

by devnull
Tue Mar 07, 2017 2:48 am
Forum: General Discussion and Questions
Topic: global variables across all modules
Replies: 8
Views: 4271

Re: global variables across all modules

@deshipu - Thanks, that works very well.

I did not know that if you modified variables in a imported module, that it would retain those values when imported into another.
by devnull
Mon Mar 06, 2017 12:52 pm
Forum: General Discussion and Questions
Topic: global variables across all modules
Replies: 8
Views: 4271

Re: global variables across all modules

Thanks so much for helping, but wouldn't that require me to write a global module file on every boot / wakeup, I would prefer not to do that.

It would be far easier to just read it once and make it available in memory ??
by devnull
Mon Mar 06, 2017 12:22 pm
Forum: General Discussion and Questions
Topic: global variables across all modules
Replies: 8
Views: 4271

Re: global variables across all modules

During bootup I read the vcc level, and also detect the boot mode, either setup or run, this mode is changed by a long / short press on a button as well as reading a .json file 'mode' variable. which is set using a mqtt subscription During bootup I also read a json file that contains the wlan connec...
by devnull
Mon Mar 06, 2017 11:48 am
Forum: General Discussion and Questions
Topic: global variables across all modules
Replies: 8
Views: 4271

global variables across all modules

I would like to have 3 or 4 read-only global variables that are set during the boot up sequence to be made available in every module without needing an additional import, i.e truly global variables. I thought that I could do this by adding them to the __builtins__ however this does not appear to be ...
by devnull
Sat Mar 04, 2017 7:09 am
Forum: ESP8266 boards
Topic: format the file system
Replies: 2
Views: 2434

Re: format the file system

OK, answering my own post here:

Code: Select all

import os
import flashbdev
os.VfsFat.mkfs(flashbdev.bdev)
by devnull
Sat Mar 04, 2017 6:48 am
Forum: ESP8266 boards
Topic: format the file system
Replies: 2
Views: 2434

format the file system

I assumed that esptool erase_flash would erase my user files but it does not, and it appears that my file system is corrupted as when I list the root folder, there are dozens of lines with just a dot "." and no file name. Is there a way to erase or re-format the file system ?? When I list using ampy...
by devnull
Mon Feb 27, 2017 9:35 am
Forum: ESP8266 boards
Topic: esp.deepsleep() overflow
Replies: 3
Views: 2326

Re: esp.deepsleep() overflow

@jamesb - thanks so much, yes I am aware of that method as well, but I was wondering what the limitation with the more concise esp.deepsleep() was.
by devnull
Mon Feb 27, 2017 7:09 am
Forum: ESP8266 boards
Topic: How to determine wlan connected ESSID ?
Replies: 1
Views: 1124

How to determine wlan connected ESSID ?

I am trying to get the connected ssid, however this is failing: >>> from network import WLAN,STA_IF >>> sta = WLAN(STA_IF) >>> print(sta.config('essid')) Traceback (most recent call last): File "<stdin>", line 1, in <module> OSError: AP required I don't understand the error AP required ? Also, is it...
by devnull
Sun Feb 26, 2017 1:35 pm
Forum: General Discussion and Questions
Topic: http server closing connection
Replies: 0
Views: 737

http server closing connection

Seem that I am pretty much the only person posting on this forum ?! I have a problem with my simple http server related to the size of the received request. The following is a code snippet of the bit that handles the request. Something strange is happening once the received packet hits 536 bytes, if...
by devnull
Sun Feb 26, 2017 4:11 am
Forum: General Discussion and Questions
Topic: url decode
Replies: 2
Views: 8809

url decode

How can I decode a url-encoded string as ujson() is unable to convert it and I urllib does not appear to have parse() method ? %7B%22_mode%22:%22func%22,%22_name%22:%22download%22,%22file_path%22:%22main.py%22,%22update_host%22:%22192.168.0.35%22,%22update_port%22:3001%7D Converts to: {"_mode":"func...