diff --git a/app/css/themes/dark.css b/app/css/themes/dark.css index bfbc42e..a266160 100644 --- a/app/css/themes/dark.css +++ b/app/css/themes/dark.css @@ -98,7 +98,7 @@ body.theme_dark, .theme_dark div.window, .theme_dark .card { } .theme_dark .dropdown-toggle:not(.success) { - border: 1px solid #555; + border: 1px solid #333; } .theme_dark .dropdown-toggle::before { diff --git a/app/js/grbl-settings.js b/app/js/grbl-settings.js index 9e1fffe..7cd6f5c 100644 --- a/app/js/grbl-settings.js +++ b/app/js/grbl-settings.js @@ -131,6 +131,16 @@ function grblSettings(data) { } } +function showBasicSettings() { + $("#grbl-settings-basic").show(); + $("#grbl-settings-advanced").hide(); +} + +function showAdvSettings() { + $("#grbl-settings-basic").hide(); + $("#grbl-settings-advanced").show(); +} + function grblPopulate() { if (!isJogWidget) { $('#grblconfig').show(); @@ -138,7 +148,13 @@ function grblPopulate() { var template = `
-
+ + + +
  • Select your Machine
    Tell us what machine you have?
    @@ -285,34 +301,34 @@ function grblPopulate() {
  • -
    Advanced Settings
    If you have any custom requirements, - please customise the settings in the Advanced Settings section
    +
    Finished
    Remember to "Save to Firmware" and Reset when Prompted.
    If you have any custom requirements, + please customise the settings in the Advanced Settings section above
    +
  • - -
    -
    -
    - - - - - - - - - - ` + + + +
    KeyParameterValueUtility
    + + + + + + + + + ` for (key in grblParams) { var key2 = key.split('=')[0].substr(1); @@ -320,35 +336,34 @@ function grblPopulate() { if (grblSettingsTemplate2[key2] !== undefined) { //template += grblSettingsTemplate2[key2].template; template += ` - - - - - ` + title="` + grblSettingsTemplate2[key2].description + `"> + + + + + ` } else { template += ` - - - - - - - ` + + + + + + + ` } } template += ` -
    KeyParameterValueUtility
    ` + grblSettingsTemplate2[key2].key + `` + grblSettingsTemplate2[key2].title + `` + grblSettingsTemplate2[key2].template + `` + grblSettingsTemplate2[key2].utils + `
    ` + grblSettingsTemplate2[key2].key + `` + grblSettingsTemplate2[key2].title + `` + grblSettingsTemplate2[key2].template + `` + grblSettingsTemplate2[key2].utils + `
    ` + key + `` + key + `
    ` + key + `` + key + `
    -
    -
    - + +
- -
+ + + ` $('#grblconfig').append(template) @@ -398,43 +413,100 @@ function grblPopulate() { } +// function checkifchanged() { +// var hasChanged = false; +// for (var key in grblParams) { +// if (grblParams.hasOwnProperty(key)) { +// var j = key.substring(1) +// var newVal = $("#val-" + j + "-input").val(); +// +// if (newVal !== undefined) { +// // Only send values that changed +// if (newVal != grblParams[key]) { +// hasChanged = true; +// console.log("changed: " + key) +// console.log("old: " + grblParams[key]) +// console.log("new: " + newVal) +// if (!$("#val-" + j + "-input").parent().is('td')) { +// $("#val-" + j + "-input").parent().addClass('alert') +// } else if ($("#val-" + j + "-input").is('select')) { +// $("#val-" + j + "-input").addClass('alert') +// } else if (j == 3) { // axes +// $('#xdirinvert').parent().children('.check').addClass('bd-red') +// $('#ydirinvert').parent().children('.check').addClass('bd-red') +// $('#zdirinvert').parent().children('.check').addClass('bd-red') +// } +// } else { +// if (!$("#val-" + j + "-input").parent().is('td')) { +// $("#val-" + j + "-input").parent().removeClass('alert') +// } else if ($("#val-" + j + "-input").is('select')) { +// $("#val-" + j + "-input").removeClass('alert') +// } else if (j == 3) { +// $('#xdirinvert').parent().children('.check').removeClass('bd-red') +// $('#ydirinvert').parent().children('.check').removeClass('bd-red') +// $('#zdirinvert').parent().children('.check').removeClass('bd-red') +// } +// } +// } +// } +// } +// if (hasChanged) { +// $('#grblSettingsBadge').fadeIn('slow'); +// $('#saveBtn').attr('disabled', false).removeClass('disabled'); +// $('#saveBtnIcon').removeClass('fg-gray').addClass('fg-grayBlue'); +// } else { +// $('#grblSettingsBadge').fadeOut('slow'); +// $('#saveBtn').attr('disabled', true).addClass('disabled'); +// $('#saveBtnIcon').removeClass('fg-grayBlue').addClass('fg-gray'); +// } +// } + function checkifchanged() { var hasChanged = false; + for (var key in grblParams) { if (grblParams.hasOwnProperty(key)) { - var j = key.substring(1) + var j = key.substring(1); var newVal = $("#val-" + j + "-input").val(); if (newVal !== undefined) { - // Only send values that changed - if (newVal != grblParams[key]) { + // Determine if the value should be compared as text or number + var oldVal = grblParams[key]; + var compareAsNumber = !isNaN(parseFloat(oldVal)) && !isNaN(parseFloat(newVal)); + + // Perform appropriate comparison + if ((compareAsNumber && parseFloat(newVal) !== parseFloat(oldVal)) || + (!compareAsNumber && newVal !== oldVal)) { hasChanged = true; - console.log("changed: " + key) - console.log("old: " + grblParams[key]) - console.log("new: " + newVal) + + console.log("changed: " + key); + console.log("old: " + oldVal); + console.log("new: " + newVal); + if (!$("#val-" + j + "-input").parent().is('td')) { - $("#val-" + j + "-input").parent().addClass('alert') + $("#val-" + j + "-input").parent().addClass('alert'); } else if ($("#val-" + j + "-input").is('select')) { - $("#val-" + j + "-input").addClass('alert') + $("#val-" + j + "-input").addClass('alert'); } else if (j == 3) { // axes - $('#xdirinvert').parent().children('.check').addClass('bd-red') - $('#ydirinvert').parent().children('.check').addClass('bd-red') - $('#zdirinvert').parent().children('.check').addClass('bd-red') + $('#xdirinvert').parent().children('.check').addClass('bd-red'); + $('#ydirinvert').parent().children('.check').addClass('bd-red'); + $('#zdirinvert').parent().children('.check').addClass('bd-red'); } } else { if (!$("#val-" + j + "-input").parent().is('td')) { - $("#val-" + j + "-input").parent().removeClass('alert') + $("#val-" + j + "-input").parent().removeClass('alert'); } else if ($("#val-" + j + "-input").is('select')) { - $("#val-" + j + "-input").removeClass('alert') + $("#val-" + j + "-input").removeClass('alert'); } else if (j == 3) { - $('#xdirinvert').parent().children('.check').removeClass('bd-red') - $('#ydirinvert').parent().children('.check').removeClass('bd-red') - $('#zdirinvert').parent().children('.check').removeClass('bd-red') + $('#xdirinvert').parent().children('.check').removeClass('bd-red'); + $('#ydirinvert').parent().children('.check').removeClass('bd-red'); + $('#zdirinvert').parent().children('.check').removeClass('bd-red'); } } } } } + if (hasChanged) { $('#grblSettingsBadge').fadeIn('slow'); $('#saveBtn').attr('disabled', false).removeClass('disabled'); @@ -446,6 +518,7 @@ function checkifchanged() { } } + function grblSaveSettings() { var toSaveCommands = []; var saveProgressBar = $("#grblSaveProgress").data("progress");