Skip to content

Settings

George Joseph edited this page Apr 11, 2021 · 4 revisions

Settings

There are some DueUI settings, apart from layout configuration, that must be configured like the hostname or IP address of the Duet or the SBC hosting the DuetSoftwareFramework (DSF).

Setting Parameters

Setting Name Parameter Name Default Value Description
Duet or DSF hostname or IP address duet_host
Duet Password duet_password "reprap"
DueUI config file URL dueui_config_url The URL of your dueui_config.json file.
Status poll interval duet_poll_interval_1 1000 Interval at which the Duet's model is polled (Not used with DSF)
Theme theme_name Cerulean
Debug Polling duet_debug_polling_enabled 0 (off) If set, you can use the browser's console to view the poll results in real time. Not recommended.
Simulate GCode dueui_settings_dont_send_gcode 0 (off) If set, GCode commands will not be set to the Duet.
Test Mode dueui_test_mode 0 (off) If set, allows you to design and do limited testing of your layout without being connected to a Duet or SBC
Polling duet_polling_enabled 0 (off) Set for normal operation
Hide Settings Panel hide_settings 0 (no) If you've defined your settings in the confuration JSON file and don't want anyone to be able to change them locally, set this to 1 and the Settings panel will no longer appear in the main menubar. This setting doesn't appear on the settings panel itself.

There are 3 ways you can set the settings:

With Settings Panel

When you access DueUI for the first time, you'll be presented with a Settings panel that looks like the following:

When an setting is changed, you'll notice the "Save" button change color reminding you to save the new settings. Once saved, you should refresh the tab to make sure the new settings are applied cleanly.

If you've installed DueUI directly on just a few Duet boards or on a Duet Software Framework SBC, you probably don't need to read further. If you need to customize how your settings are found and applied, read on.

From Query Parameters

All of the settings can also be set as query parameters in the URL when you load DueUI.

For example, let's say you're operating in standalone mode and you installed DueUI on your Duet which has 192.168.0.222 as its IP address. Let's also say that your dueui_config file actually named "dueui_duet3.json" and it's in the "/sys" directory. You could enter the following URL in your browser's address bar:

http://192.168.0.222/dueui.html?dueui_config_url=dueui_duet3.json

Notice that I left off the "/sys" directory. We'll get to that later.

From The JSON Configuration File

You can also place (almost) all of your settings in your DueUI configuration JSON file. This is probably not too useful if you just have DueUI installed on 1 printer but if you operate a printer farm, this could be quite handy.

Here's the format for the settings:

configFileSettings = {
	duet_host: "<your_duet_or_DSF_address>",
	duet_password: "reprap",
	duet_poll_interval_1: 500,
	duet_debug_polling_enabled: 0,
	dueui_settings_dont_send_gcode: 0,
	dueui_test_mode: 0,
	duet_polling_enabled: 1,
	hide_settings: 0,
	theme_name: "Darkly",
};

The only item you can't specify here is dueui_config_url because, well, we're already reading from it. :)

If you are operating a printer farm, chances are that you have a standalone web server somewhere on your network, even if it's just a Raspberry Pi. You could install 1 instance of DueUI on that web server and create a DueUI Config JSON file for each printer. Each of those files would have a configFileSettings object that points to its repsective printer. If your web server directory structure were set up like this...

css/
fonts/
js/
dueui.html
printer1_config.json
printer2_config.json

A URL that connects to printer1 would look like...

http://<your_web_server>/dueui.html?dueui_config_url=printer1_config.json

You could then create a simple web page like this...

<html>
<body>
<a href="dueui.html?dueui_config_url=printer1_config.json">Printer 1</a><br>
<a href="dueui.html?dueui_config_url=printer2_config.json">Printer 2</a><br>
</body>
</html>

Save that into a file named index.html and place it in the same directory as dueui.html and you now have access to all your printers by simply browsring to http://<your web_server>/

Configuration JSON File Search Order

Since you can actually put settings in the JSON file, we've got to make an attempt to find one before we do much else. Here's the search order...

  1. If dueui_config_url is already specified in the browser's local settings, session settings or query parameters AND it begins with http, we assume it's an absolute URL pointing to the config file and we load that. If we can't load that file for some reason, we just stop, pop up an error message, then take you to the Settings panel.

  2. If DueUI is installed on an actual Duet or Duet Software Framework SBC, or duet_host is already set to one...

    1. If dueui_config_url is set and it begins with a '/', we load that file assuming its relative to the top of the Duet/DSFs SD Card.
    2. If dueui_config_url is set and it doesn't begin with a '/', we look for that file in "/sys".
    3. If dueui_config_url is not set, or the previous 2 steps failed, we load /sys/dueui_config_default.json since that file was installed when DueUI is installed.
  3. If DueUI is installed on a standalone web server...

    1. If dueui_config_url is set and it begins with a '/', we load that file assuming its relative to the top of the web server's document root.
    2. If dueui_config_url is set and it doesn't begin with a '/', we look for that file in the same directory where dueui.html resides.
    3. If dueui_config_url is not set, or the previous 2 steps failed, we load dueui_config_default.json from the same directory where dueui.html resides since that file was installed when DueUI is installed.

It's a little complicated but if you're simply installing DueUI directly on a Duet or DSF, you'll probably have you config file in the /sys directory and you won't need to deal with it.

Settings Precedence

With 4 sources of settings, the order in which they're loaded becomes important so here's the order in which they're applied.

  1. DueUI default settings
  2. Settings from the configuration JSON file (assuming one was found using the above process AND it contains a configFileSettings object)
  3. Settings from the browser's local storage
  4. Settings specified in the URL query parameters

For any individual settings, the last one found wins. So anything set in the URL query parameters will override all the others.

Custom Settings

If your config.json file is derived from dueui_settings_default.json, you'll have noticed that the speed and endstop sense dropdowns on the Movement panel save their values. If you look at the config for one of the dropdowns you'll see {"type": "setting", "setting": "jog_x_speed", "fire_on_startup": true}. This causes the value to be saved temporarily in the "jog_x_speed" variable. Changing any of those values will also highlight the "save" button in the menu bar to remind you to save the new values.