flag mode info with * when profile has been modified from what was saved

This commit is contained in:
Stewart Allen 2021-01-29 13:12:35 -05:00
commit eb7a35a9ea
2 changed files with 23 additions and 7 deletions

View file

@ -640,10 +640,12 @@
if (name) {
let np = pl[name] = {};
cp.processName = name;
pl[name] = Object.clone(cp);
for (let k in cp) {
if (!cp.hasOwnProperty(k)) continue;
np[k] = cp[k];
}
s.cproc[mode] = name;
s.devproc[s.device.deviceName] = name;
API.conf.save();
API.conf.update();

View file

@ -1950,23 +1950,37 @@
}
function updateSettings(opt = {}) {
updateSettingsFromFields(settings.controller);
switch (settings.controller.units) {
let { controller, device, process, mode, sproc, cproc } = settings;
updateSettingsFromFields(controller);
switch (controller.units) {
case 'mm': UC.setUnits(1); break;
case 'in': UC.setUnits(25.4); break;
}
if (opt.controller) {
return;
}
updateSettingsFromFields(settings.device);
updateSettingsFromFields(settings.process);
let device = settings.device;
updateSettingsFromFields(device);
updateSettingsFromFields(process);
if (device.extruders && device.extruders[device.internal]) {
updateSettingsFromFields(device.extruders[device.internal]);
}
API.conf.save();
$('mode-device').innerText = settings.device.deviceName;
$('mode-profile').innerText = settings.cproc[settings.mode];
let current = process;
let compare = sproc[mode][cproc[mode]];
let same = true;
for (let [key, val] of Object.entries(compare).filter(v => v[0] !== 'processName')) {
let tval = current[key];
// outputLoopLayers misbehaving and setting null on empty
if (val === '' && tval == null) {
continue;
}
if (tval != val) {
// console.log(key, 'expected', val, 'got', tval);
same = false;
}
}
$('mode-device').innerText = device.deviceName;
$('mode-profile').innerText = `${cproc[mode]}${same ? '' : ' *'}`;
}
function saveSettings() {