Skip to content
This repository was archived by the owner on May 24, 2023. It is now read-only.

Commit ae520db

Browse files
Added checkbox for uploading all file types
1 parent e52b667 commit ae520db

File tree

4 files changed

+40
-28
lines changed

4 files changed

+40
-28
lines changed

lib/board/project-status.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export default class ProjectStatus {
115115
}else{
116116
console.log("No files in folder "+file_path)
117117
}
118-
}else if(this.allowed_file_types.indexOf(filename.split('.').pop()) > -1){
118+
}else if(this.settings.sync_all_file_types || this.allowed_file_types.indexOf(filename.split('.').pop()) > -1){
119119
this.total_file_size += stats.size
120120
this.total_number_of_files += 1
121121
var contents = fs.readFileSync(file_path)

lib/board/sync.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ export default class Sync {
226226
var existing_files = []
227227
for(var i=0;i<file_list.length;i++){
228228
var file = file_list[i]
229-
if(_this.allowed_file_types.indexOf(file.split('.').pop()) > -1){
229+
if(_this.settings.sync_all_file_types || _this.allowed_file_types.indexOf(file.split('.').pop()) > -1){
230230
if(_this.files.indexOf(file) > -1){
231231
existing_files.push(file)
232232
}else{

lib/config.js

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ export default class Config {
4949
description: 'Either connect through USB serial using a comport, or an IP address for a telnet connection. Username and password are not needed for serial connections.',
5050
order: 1
5151
},
52+
auto_connect: {
53+
type: 'boolean',
54+
default: false,
55+
title: 'Autoconnect on USB',
56+
description: 'Ignores any \'device address\' setting and automatically connects to the top item in the serialport list',
57+
order: 2
58+
},
5259
username: {
5360
type: 'string',
5461
default: 'micro',
@@ -61,54 +68,54 @@ export default class Config {
6168
title: 'Password',
6269
order: 4
6370
},
64-
auto_connect: {
65-
type: 'boolean',
66-
default: false,
67-
title: 'Autoconnect on USB',
68-
description: 'Ignores any \'device address\' setting and automatically connects to the top item in the serialport list',
69-
order: 2
70-
},
71-
ctrl_c_on_connect: {
72-
type: 'boolean',
73-
default: false,
74-
title: 'Ctrl-c on connect',
75-
description: 'Stops all running programs when connecting to the board',
76-
order: 7
77-
},
7871
sync_folder: {
7972
type: 'string',
8073
default: "",
8174
title: 'Sync Folder',
8275
description: 'This folder will be uploaded to the pyboard when using the sync button. Leave empty to sync the complete project. (only allows folders within the project). Use a path relative to the project you opened in atom, without leading or trailing slash',
8376
order: 5
8477
},
78+
sync_all_file_types: {
79+
type: 'boolean',
80+
default: false,
81+
title: 'Upload all file types',
82+
description: 'If enabled, all files will be uploaded, no matter if the extension matches the list below',
83+
order: 6
84+
},
8585
sync_file_types: {
8686
type: 'string',
87-
default: "py,txt,log,json,xml,html,js,css",
88-
title: 'Sync file types',
89-
description: 'All types of files that will be synced to the board, seperated by comma. All other filetypes will be ignored during a sync action',
90-
order: 6
87+
default: "py,txt,log,json,xml,html,js,css,mpy",
88+
title: 'Upload file types',
89+
description: 'All types of files that will be uploaded to the board, seperated by comma. All other filetypes will be ignored during an upload (or download) action',
90+
order: 7
91+
},
92+
ctrl_c_on_connect: {
93+
type: 'boolean',
94+
default: false,
95+
title: 'Ctrl-c on connect',
96+
description: 'Stops all running programs when connecting to the board',
97+
order: 8
9198
},
9299
open_on_start: {
93100
type: 'boolean',
94101
default: true,
95102
title: 'Open on start',
96103
description: 'Automatically open the pymakr console and connect to the board after starting Atom',
97-
order: 8
104+
order: 9
98105
},
99106
safe_boot_on_upload: {
100107
type: 'boolean',
101108
default: false,
102109
title: 'Safe-boot before upload',
103110
description: '[Only works with firmware v1.16.0.b1 and up.] Safe boots the board before uploading to prevent running out of memory while uploading. Especially useful on older boards with less memory, but adds about 2 seconds to the upload procedure',
104-
order: 9
111+
order: 10
105112
},
106113
reboot_after_upload: {
107114
type: 'boolean',
108115
default: true,
109116
title: 'Reboot after upload',
110117
description: 'Reboots your pycom board after any upload or download action',
111-
order: 10
118+
order: 11
112119
}
113120
}
114121
}

lib/main/settings-wrapper.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export default class SettingsWrapper extends EventEmitter {
8686
this.password = this.api.config('password')
8787
this.sync_folder = this.api.config('sync_folder')
8888
this.sync_file_types = this.api.config('sync_file_types')
89+
this.sync_all_file_types = this.api.config('sync_all_file_types')
8990
this.ctrl_c_on_connect = this.api.config('ctrl_c_on_connect')
9091
this.open_on_start = this.api.config('open_on_start')
9192
this.safe_boot_on_upload = this.api.config('safe_boot_on_upload')
@@ -158,6 +159,9 @@ export default class SettingsWrapper extends EventEmitter {
158159
if('sync_file_types' in this.project_config){
159160
this.sync_file_types = this.project_config.sync_file_types
160161
}
162+
if('sync_all_file_types' in this.project_config){
163+
this.sync_all_file_types = this.project_config.sync_all_file_types
164+
}
161165
if('ctrl_c_on_connect' in this.project_config){
162166
this.ctrl_c_on_connect = this.project_config.ctrl_c_on_connect
163167
}
@@ -181,15 +185,16 @@ export default class SettingsWrapper extends EventEmitter {
181185
"username": this.api.config('username'),
182186
"password": this.api.config('password'),
183187
"sync_folder": this.api.config('sync_folder'),
188+
"sync_file_types": this.api.config('sync_file_types'),
189+
"sync_all_file_types": this.api.config('sync_all_file_types'),
184190
"open_on_start": this.api.config('open_on_start'),
185191
"safe_boot_on_upload": this.api.config('safe_boot_on_upload'),
186192
"statusbar_buttons": this.api.config('statusbar_buttons')
187193
}
188-
if(global){
189-
config.sync_file_types = this.api.config('sync_file_types')
190-
config.auto_connect = this.api.config('auto_connect')
191-
config.ctrl_c_on_connect = this.api.config('ctrl_c_on_connect')
192-
}
194+
// if(global){
195+
// config.auto_connect = this.api.config('auto_connect')
196+
// config.ctrl_c_on_connect = this.api.config('ctrl_c_on_connect')
197+
// }
193198
return config
194199
}
195200

0 commit comments

Comments
 (0)