You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran 2to3 on flash.py. (this changes mostly print statements, I think)
That left two remaining issues:
line 188. -- had to convert address into an int
def write_flash_many(self, tupl):
if not tupl: return
print('Flashing %s' % ', '.join('0x%x: %s' % (int(address), os.path.basename(path)) for (address, path) in tupl))
line 190 -- same thing
os.system("python esptool.py -p %s write_flash -fs 32m -fm %s -ff 40m %s" % (self.port, self.flashmode, ' '.join("0x%x %s" % (int(a),p) for a,p in tupl)))
flash.py seems to run OK now.
Surprisingly I did not seem to have to change esptool.py
A python3 version of esptool.py has been installed by pip, so it seems to use this one.
The changed file is attached.
(Sorry I am not used to this - I had to change to txt extension to get it to upload)
Also problem with a strange x character in ping.forth comment which does not get decoded by utf-8.
\ Distance = (high level time×velocity of sound (340M/S)
I just replaced this character in a text editor
===========================
GPIO load
: emit-pulse ( trigger-pin -- )
dup GPIO_OUT gpio-mode
dup GPIO_LOW gpio-write
2 us
dup GPIO_HIGH gpio-write
10 us
GPIO_LOW gpio-write ;
: listen-echo ( echo-pin timeout-us -- ms )
over GPIO_IN gpio-mode
GPIO_HIGH rot pulse-len ;
\ Measures the pulse generated by ultrasonic ranging module (tested with: HC-SR04 sensors)
\ Works the following way:
\ (1) Using IO trigger for at least 10us high level signal,
\ (2) The Module automatically sends eight 40 kHz and detect whether there is a pulse signal back.
\ (3) IF the signal back, time of high output IO duration is the time from sending ultrasonic to returning.
\ Distance = (high level time x velocity of sound (340M/S) / 2,
\ Usage example: PIN_ECHO 100 cm>timeout PIN_TRIGGER ping pulse>cm
: ping ( echo-pin timeout-us trigger-pin -- pulse-duration-us )
os-enter-critical
{ emit-pulse listen-echo } catch
os-exit-critical
throw ;
: cm>timeout ( cm -- us ) 60 * ;
: inch>timeout ( inch -- us ) 150 * ;
: pulse>cm ( us -- cm ) 58 / ;
: pulse>inch ( us -- inch ) 148 / ;
/end
I did a simple conversion to python3
line 188. -- had to convert address into an int
def write_flash_many(self, tupl):
if not tupl: return
print('Flashing %s' % ', '.join('0x%x: %s' % (int(address), os.path.basename(path)) for (address, path) in tupl))
line 190 -- same thing
os.system("python esptool.py -p %s write_flash -fs 32m -fm %s -ff 40m %s" % (self.port, self.flashmode, ' '.join("0x%x %s" % (int(a),p) for a,p in tupl)))
flash.py seems to run OK now.
Surprisingly I did not seem to have to change esptool.py
A python3 version of esptool.py has been installed by pip, so it seems to use this one.
The changed file is attached.
(Sorry I am not used to this - I had to change to txt extension to get it to upload)
flash.py.txt
Also:-
This is for esp8266. I am running a macbook on catalina.
The text was updated successfully, but these errors were encountered: