Skip to content

Commit 72f2bbb

Browse files
authored
Merge pull request #108 from PropGit/results_simplify
Enabled coded download messages
2 parents 7fa02c2 + 44ee2c5 commit 72f2bbb

File tree

5 files changed

+27
-12
lines changed

5 files changed

+27
-12
lines changed

BlocklyPropClient.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
# Please verify that the version number in the local about.txt and the
3737
# ./package/win-resources/blocklypropclient-installer.iss matches this.
3838
# -----------------------------------------------------------------------
39-
VERSION = "0.7.0"
39+
VERSION = "0.7.5"
4040

4141

4242
# Enable logging for functions outside of the class definition
@@ -229,7 +229,7 @@ def handle_connect(self):
229229
# read entered values and start server
230230
self.server_process = multiprocessing.Process(
231231
target=BlocklyServer.main,
232-
args=(int(self.port.get()), self.version, self.q))
232+
args=(int(self.port.get()), self.version, self.app_version, self.q))
233233

234234
self.server_process.start()
235235

BlocklyServer.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@
2121

2222
class BlocklyServer(object):
2323

24-
def __init__(self, version, queue):
24+
def __init__(self, version, app_version, queue):
2525
self.logger = logging.getLogger('blockly.server')
2626
self.logger.info('Creating server logger.')
2727

2828
self.version = version
29+
self.app_version = app_version
2930
self.queue = queue
3031

3132
# Find the path from which application was launched
@@ -47,9 +48,11 @@ def __init__(self, version, queue):
4748
def index(self):
4849
cherrypy.response.headers['Access-Control-Allow-Origin'] = '*'
4950

51+
# version supports pre-0.99 web clients, version_str supports v0.99+ web clients
5052
serverinfo = {
5153
"server": "BlocklyPropHTTP",
52-
"version": self.version
54+
"version": self.version,
55+
"version_str": self.app_version
5356
}
5457
self.queue.put((1, 'TRACE', 'Server poll received'))
5558
self.logger.debug('Server poll received')
@@ -85,7 +88,7 @@ def ports(self):
8588
@cherrypy.expose(alias='load.action')
8689
@cherrypy.tools.json_out()
8790
@cherrypy.tools.allow(methods=['POST'])
88-
def load(self, action, binary, extension, comport=None):
91+
def load(self, option, action, binary, extension, comport=None):
8992
if action is None:
9093
self.logger.error('Load action is undefined.')
9194
return {
@@ -105,7 +108,7 @@ def load(self, action, binary, extension, comport=None):
105108

106109
self.logger.debug('Loading program to device.')
107110

108-
(success, out, err) = self.propellerLoad.download(action, binary_file, comport)
111+
(success, out, err) = self.propellerLoad.download(option, action, binary_file, comport)
109112
self.queue.put((10, 'INFO', 'Application loaded (%s)' % action))
110113

111114
self.logger.info('Application load complete.')
@@ -125,7 +128,7 @@ def serial_socket(self):
125128
handler = cherrypy.request.ws_handler
126129

127130

128-
def main(port, version, queue):
131+
def main(port, version, app_version, queue):
129132
module_logger.info("Server starting")
130133
queue.put((10, 'INFO', 'Server starting'))
131134

@@ -137,7 +140,7 @@ def main(port, version, queue):
137140

138141
queue.put((10, 'INFO', 'Websocket configured'))
139142

140-
cherrypy.quickstart(BlocklyServer(version, queue), '/', config={'/serial.connect': {
143+
cherrypy.quickstart(BlocklyServer(version, app_version, queue), '/', config={'/serial.connect': {
141144
'tools.websocket.on': True,
142145
'tools.websocket.handler_cls': SerialSocket
143146
}})

PropellerLoad.py

+14-2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ def __init__(self):
6464
"EEPROM": {"compile-options": "-e"}
6565
}
6666

67+
self.loaderOption = {
68+
"CODE": {"loader-options": "-c"},
69+
"VERBOSE": {"loader-options": "-v"},
70+
"CODE_VERBOSE": {"loader-options": "-c -v"}
71+
}
72+
6773
if not platform.system() in self.loaderExe:
6874
self.logger.error('The %s platform is not supported at this time.', platform.system())
6975
print(platform.system() + " is currently unsupported")
@@ -108,7 +114,7 @@ def get_ports(self):
108114
self.discovering = False
109115

110116

111-
def download(self, action, file_to_load, com_port):
117+
def download(self, option, action, file_to_load, com_port):
112118
# Download application to Propeller
113119
# Set loading flag to prevent interruption
114120
self.loading = True
@@ -127,11 +133,17 @@ def download(self, action, file_to_load, com_port):
127133
# # launch path is blank; try extracting from argv
128134
# self.appdir = os.path.dirname(os.path.realpath(sys.argv[0]))
129135

130-
# Set command to download to RAM or EEPROM and to run afterward download
136+
# Set command options to download to RAM or EEPROM and to run after download
131137
command = []
138+
139+
if self.loaderOption[option]["loader-options"] != "":
140+
# if loader-option not empty, add it to the list
141+
command.extend([self.loaderOption[option]["loader-options"]])
142+
132143
if self.loaderAction[action]["compile-options"] != "":
133144
# if RAM/EEPROM compile-option not empty, add it to the list
134145
command.extend([self.loaderAction[action]["compile-options"]])
146+
135147
command.extend(["-r"])
136148

137149
# Specify requested port

about.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Version: v0.7.0
1+
Version: v0.7.5
22

33
Contributors:
44
- Michel Lampo

package/blocklypropclient-installer.iss

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
33

44
#define MyAppName "BlocklyPropClient"
5-
#define MyAppVersion "0.7.0"
5+
#define MyAppVersion "0.7.5"
66
#define MyAppPublisher "Parallax Inc."
77
#define MyAppURL "http://blockly.parallax.com/"
88
#define MyAppExeName "BlocklyPropClient.exe"

0 commit comments

Comments
 (0)