Search found 60 matches

by VladVons
Thu Feb 27, 2020 5:25 am
Forum: ESP8266 boards
Topic: what a min free memory amount for stable work on esp8266 ?
Replies: 3
Views: 2774

Re: what a min free memory amount for stable work on esp8266 ?

All my project sources *.py files is 15K I compiled *.py files into *.mpy with micropython mpy-cross utility for linux and got 8K of *.mpy Sent them to esp8266 flash with a command: mpy-cross Inc/NetHttp.py -o Inc/NetHttp.mpy .... .... ampy --port /dev/ttyUSB0 --baud 115200 put Inc In both cases (*....
by VladVons
Wed Feb 26, 2020 9:25 pm
Forum: ESP8266 boards
Topic: what a min free memory amount for stable work on esp8266 ?
Replies: 3
Views: 2774

what a min free memory amount for stable work on esp8266 ?

In pure micropython ver 1.12 there is approx 32K of free memory to use. Earlier versions 1.9 had only 30k free. So thanks micropython team for great job to save 2K. It is a lot! I have already included asyncio, mqtt, http server, captive DNS, wifi connection, logging, settings saving, queues. This m...
by VladVons
Wed Feb 26, 2020 7:54 am
Forum: ESP8266 boards
Topic: 'goto' in micropython
Replies: 11
Views: 15341

Re: 'goto' in micropython

Thatks Peter
with LabelEnd you are right

any idea about LabelA?
by VladVons
Wed Feb 26, 2020 6:01 am
Forum: ESP8266 boards
Topic: 'goto' in micropython
Replies: 11
Views: 15341

'goto' in micropython

I know all horrow stories about GOTO, but nevertheless.... under python for PC there is a 6k library "goto-statement" It is not small for ESP8266 how to exit from nested loop? def LabeledNestedLoop(aMax): for A in range(10): #LabelA for B in range(10): for C in range(10): print(A, B, C) if (C == aMa...
by VladVons
Mon Feb 24, 2020 5:03 pm
Forum: ESP8266 boards
Topic: Get caller method name from a stack
Replies: 9
Views: 11685

Re: Get caller method name from a stack

Two reasons: 1) Main is less code size It gives more free usefull RAM for tiny esp8266 (32K free pure memory only !) 2) Less WrongNamedCallers in a bullshits code By the way how to free memory from unused imports, classes, functions? Relative post was here, but no sucsess with it. https://forum.micr...
by VladVons
Mon Feb 24, 2020 12:56 pm
Forum: ESP8266 boards
Topic: Get caller method name from a stack
Replies: 9
Views: 11685

Re: Get caller method name from a stack

I use this trick for logging both message + caller

Code: Select all

def Log(aMsg, aCallerName = 'unknown'):
  # to minimize code size it would be good to get a aCallerName from a stack here
  print(aMsg, aCallerName )
  
def Func1():
  Log('Message1', 'Func1()')

def Func2():
  Log('Message2')
by VladVons
Fri Feb 21, 2020 8:23 pm
Forum: ESP8266 boards
Topic: Get caller method name from a stack
Replies: 9
Views: 11685

Get caller method name from a stack

within a function i want to know who called me another words i want to trace stack in python for PC there is a module 'inspect' and method 'stack()' From there I can get a stack information: File name Caller method name Method's line number def MethodA(): # some code to get a caller name # in my cas...
by VladVons
Sun Feb 16, 2020 10:16 pm
Forum: ESP8266 boards
Topic: How to check if RST button is pressed 3 seconds?
Replies: 1
Views: 1983

How to check if RST button is pressed 3 seconds?

On a WeMos-D1-Mini ESP8266 development board there is one button - RST (reset) Board can be rebooted after button press-release action. While button is in a pressed state the application is still alive (i see terminal screen) but freezed If i release a button than application reboots. So i want to u...
by VladVons
Sat Feb 15, 2020 8:27 am
Forum: ESP8266 boards
Topic: [SOLVED] async read keypressed in terminal
Replies: 5
Views: 6563

Re: async read keypressed in terminal [SOLVED]

thanks jimmo import uasyncio as asyncio import sys import select async def Task1(): while True: print('Task1') await asyncio.sleep(1) async def Task2(): while True: await asyncio.sleep(0.1) while sys.stdin in select.select([sys.stdin], [], [], 0)[0]: ch = sys.stdin.read(1) print('none block input ch...
by VladVons
Fri Feb 14, 2020 6:57 pm
Forum: ESP8266 boards
Topic: [SOLVED] async read keypressed in terminal
Replies: 5
Views: 6563

[SOLVED] async read keypressed in terminal

i want to read in terminal keypressed while http server is running.
please hint me