Permalink
Browse files

Add flash mode 'dout'

Fixes #20
  • Loading branch information...
marcelstoer committed Sep 15, 2017
1 parent 4d73e11 commit 0116a91e5332b5956dd766e64e6839fcbd64399b
Showing with 159 additions and 4 deletions.
  1. +30 −0 HtmlPopupTransientWindow.py
  2. +41 −4 Main.py
  3. +1 −0 encode-bitmaps.py
  4. +87 −0 images.py
  5. BIN images/info.png
@@ -0,0 +1,30 @@

# coding=utf-8

import wx
import wx.html
import webbrowser


class HtmlPopupTransientWindow(wx.PopupTransientWindow):
def __init__(self, parent, style, html_body_content, bgcolor, size):
wx.PopupTransientWindow.__init__(self, parent, style)
panel = wx.Panel(self)
panel.SetBackgroundColour(bgcolor)

html_window = self.HtmlWindow(panel, wx.ID_ANY, size=size)
html_window.SetPage('<body bgcolor="' + bgcolor + '">' + html_body_content + '</body>')

sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(html_window, 0, wx.ALL, 5)
panel.SetSizer(sizer)

sizer.Fit(panel)
sizer.Fit(self)
self.Layout()

class HtmlWindow(wx.html.HtmlWindow):
def OnLinkClicked(self, link):
# get a hold of the PopupTransientWindow to close it
self.GetParent().GetParent().Dismiss()
webbrowser.open(link.GetHref())
45 Main.py
@@ -15,6 +15,20 @@
from argparse import Namespace

__version__ = "2.1"
__flash_help__ = '''
<p>This setting is highly dependent on your device!<p>
<p>
Details at <a style="color: #004CE5;"
href="https://www.esp32.com/viewtopic.php?p=5523&sid=08ef44e13610ecf2a2a33bb173b0fd5c#p5523">http://bit.ly/2v5Rd32</a>
and in the <a style="color: #004CE5;" href="https://github.com/espressif/esptool/#flash-modes">esptool
documentation</a>
<ul>
<li>Most ESP32 and ESP8266 ESP-12 use 'dio'.</li>
<li>Most ESP8266 ESP-01/07 use 'qio'.</li>
<li>ESP8285 requires 'dout'.</li>
</ul>
</p>
'''
__supported_baud_rates__ = [9600, 57600, 74880, 115200, 230400, 460800, 921600]

# ---------------------------------------------------------------------------
@@ -95,7 +109,7 @@ class FlashConfig:
def __init__(self):
self.baud = 115200
self.erase_before_flash = False
self.mode = "qio"
self.mode = "dio"
self.firmware_path = None
self.port = None

@@ -228,8 +242,9 @@ def add_flash_mode_radio_button(sizer, idx, mode, label):
sizer.Add(radio_button)
sizer.AddSpacer(10)

add_flash_mode_radio_button(flashmode_boxsizer, 0, "qio", "Quad Flash I/O (qio)")
add_flash_mode_radio_button(flashmode_boxsizer, 1, "dio", "Dual Flash I/O (dio), usually for >=4MB flash chips")
add_flash_mode_radio_button(flashmode_boxsizer, 0, "qio", "Quad I/O (qio)")
add_flash_mode_radio_button(flashmode_boxsizer, 1, "dio", "Dual I/O (dio)")
add_flash_mode_radio_button(flashmode_boxsizer, 2, "dout", "Dual Output (dout)")

erase_boxsizer = wx.BoxSizer(wx.HORIZONTAL)

@@ -259,14 +274,36 @@ def add_erase_radio_button(sizer, idx, erase_before_flash, label, value):
file_label = wx.StaticText(panel, label="NodeMCU firmware")
baud_label = wx.StaticText(panel, label="Baud rate")
flashmode_label = wx.StaticText(panel, label="Flash mode")

def on_info_hover(event):
from HtmlPopupTransientWindow import HtmlPopupTransientWindow
win = HtmlPopupTransientWindow(self, wx.SIMPLE_BORDER, __flash_help__, "#FFB6C1", (410, 140))

image = event.GetEventObject()
image_position = image.ClientToScreen((0, 0))
image_size = image.GetSize()
win.Position(image_position, (0, image_size[1]))

win.Popup()

icon = wx.StaticBitmap(panel, wx.ID_ANY, images.Info.GetBitmap())
icon.Bind(wx.EVT_BUTTON, on_info_hover)
icon.Bind(wx.EVT_LEFT_DOWN, on_info_hover)
icon.Bind(wx.EVT_RIGHT_DOWN, on_info_hover)

flashmode_label_boxsizer = wx.BoxSizer(wx.HORIZONTAL)
flashmode_label_boxsizer.Add(flashmode_label, 1, wx.EXPAND)
flashmode_label_boxsizer.AddStretchSpacer(0)
flashmode_label_boxsizer.Add(icon, 0, wx.ALIGN_RIGHT, 20)

erase_label = wx.StaticText(panel, label="Erase flash")
console_label = wx.StaticText(panel, label="Console")

fgs.AddMany([
port_label, (serial_boxsizer, 1, wx.EXPAND),
file_label, (file_picker, 1, wx.EXPAND),
baud_label, baud_boxsizer,
flashmode_label, flashmode_boxsizer,
flashmode_label_boxsizer, flashmode_boxsizer,
erase_label, erase_boxsizer,
(wx.StaticText(panel, label="")), (button, 1, wx.EXPAND),
(console_label, 1, wx.EXPAND), (self.console_ctrl, 1, wx.EXPAND)])
@@ -10,6 +10,7 @@
"-F -n Exit images/exit.png images.py",
"-a -F -n Reload images/reload.png images.py",
"-a -F -n Splash images/splash.png images.py",
"-a -F -n Info images/info.png images.py",
"-a -F -i -n Icon images/icon-256.png images.py",
]

@@ -7606,6 +7606,93 @@
"OuPbk3NlUi8yrl/3VYFP7sMlU31aO8jWC1dyUeDftTTrOv6coEp+yK7/QzFrnT7WTSOBiWd8"
"DzjhI4F6KouFx5ME0tQbgfvfmHIzmcf7eP0AAAAASUVORK5CYII=")

#----------------------------------------------------------------------
Info = PyEmbeddedImage(
"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAMFmlDQ1BJQ0MgUHJvZmlsZQAA"
"SImVVwdYU8kWnltSCEkogQhICb0J0qv0XgSkg42QBAglQkJQsaOLCq4FFRGs6CqIomsBZK1Y"
"sLAIWLA/UFFZWRcLNlTepICur33vfN/c+e+Zc878Z+65880AoGTDzs3NRpUByBHkC6ODfFmJ"
"ScksUi/AARGggArobI4o1ycqKhxAGe3/Lu9uAUTSX7eSxPrX8f8qKlyeiAMAEgVxKlfEyYH4"
"KAC4BidXmA8AoQ3qDWfn50rwIMRqQkgQACIuwekyrCHBqTI8QWoTG+0HsTcAZCqbLUwHgC7h"
"zSrgpMM4dAlHGwGXL4B4C8SenAw2F+L7EE/IyZkFsRIZYrPU7+Kk/y1m6lhMNjt9DMtykQrZ"
"ny/KzWbP/T+X439LTrZ4dA4D2KgZwuBoSc5w3WqyZoVJMBXiE4LUiEiIVSG+xOdK7SX4boY4"
"OE5uP8AR+cE1A0wAPzWX7R8GsTbETHFWn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ur8d+Pm/t"
"Li7+FU1P3+HqBkMMtM3b+q1bX7yoVP5rptP0N5fOU/3DqvxXf4xt08urV6lerW7VNjaWtKcW"
"65te0JrmxtDG3x88uGBvbl7LtlqLpueNcceY0fh42Juacr25ud/UzMydT06efFGtVo1yuZwM"
"AN6iCd1ebFAMbf7y5Ml7ac9b4C8biTOZVlIoPNM1v30r+SU3CfA/ZNahIBhUgOQAAAAASUVO"
"RK5CYII=")

#----------------------------------------------------------------------
Icon = PyEmbeddedImage(
"iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAAAXNSR0IArs4c6QAAACBjSFJN"
BIN +4.38 KB images/info.png
Binary file not shown.

0 comments on commit 0116a91

Please sign in to comment.