Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CONFIG disable features #395

Merged
merged 3 commits into from
Nov 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion data/www/debug.log

This file was deleted.

68 changes: 55 additions & 13 deletions data/www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -139,22 +139,22 @@
line-height: 1.5;
}

body {
font-family: Futura, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}

html,
input,
optgroup {
font-size: 140%
}

body {
font-family: Futura, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
/* font-size: 140% */
}

@media only screen and (min-width: 720px) {

html,
input,
optgroup {
font-size: 140%;
/* font-size: 140%; */
}
}

Expand All @@ -163,16 +163,24 @@
html,
input,
optgroup {
font-size: 130%;
/* font-size: 130%; */
}
.flexparent {
flex-direction: row;
}

.flexchild {
width: 47.5%;
}

}

@media only screen and (min-width: 1280px) {

html,
input,
optgroup {
font-size: 120%;
/* font-size: 120%; */
}

.flexparent {
Expand All @@ -182,6 +190,7 @@
.flexchild {
width: 47.5%;
}

}
#txt_hostname
{
Expand Down Expand Up @@ -560,7 +569,7 @@
</div>
</div>
<div class="flexchild">
<header><span id="logowob"></span>TIMEZONE</header>
<header>TIME<span id="logowob"></span>ZONE</header>
<div class="detline">
<div class="cicon">
<div class="svgicon">
Expand Down Expand Up @@ -620,7 +629,7 @@
</div>
</div>
<div class="flexchild">
<header><span id="logowob"></span>MIDIMaze</header>
<header>MIDI<span id="logowob"></span>MAZE</header>
<div class="detline">
<div class="cicon">
<div class="svgicon">
Expand Down Expand Up @@ -654,7 +663,7 @@
</div>
</div>
<div class="flexchild">
<header><span id="logowob"></span>Program Recorder Settings</header>
<header><span id="logowob"></span>PROGRAM RECORDER</header>
<div class="detline">
<div class="cicon">
<div class="svgicon">
Expand Down Expand Up @@ -696,14 +705,15 @@
<script>
var current_pulldown = "<%FN_PULLDOWN%>";
</script>
<hr>Current Setting: <%FN_PLAY_RECORD%>
<hr>
Current Setting: <%FN_PLAY_RECORD%>
<br>Using: <%FN_PULLDOWN%>
</div>
</div>
</div>
</div>
<div class="flexchild">
<header><span id="logowob"></span>Disk Swap Settings</header>
<header><span id="logowob"></span>DISK SWAP</header>
<div class="detline">
<div class="cicon">
<div class="svgicon">
Expand Down Expand Up @@ -791,6 +801,38 @@
</div>
</div>
</div>
<div class="flexchild">
<header><span id="logowob"></span>MISC</header>
<div class="detline">
<div class="cicon">
<div class="svgicon">
</div>
</div>
<div class="cform">
<div class="formwrapper">
<br>Enable CONFIG Boot Disk
<form action="/config" method="post">
<select name="config_enable" id="select_config_enable">
<optgroup>
<option value="1">Yes</option>
<option value="0">No</option>
</optgroup>
</select>
<input type="submit" value="Save">
</form>
<script>
var current_config_enabled = "<%FN_CONFIG_ENABLED%>";
</script>
<hr>
<span class="small">
Reboot FujiNet after changing this value.<br/>
Disabling the built-in CONFIG boot disk will require changing
disk mounts using the individual FujiNet config tools</span>
</div>
</div>
</div>
</div>

</div>
</div>
<script type="text/javascript" src="/file?settings.js"></script>
Expand Down
58 changes: 18 additions & 40 deletions data/www/settings.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,3 @@
var mySelect = document.getElementById("select_printermodel1");

var opts = mySelect.options;
for (var opt, j = 0; opt = opts[j]; j++) {
if (opt.value == current_printer) {
mySelect.selectedIndex = j;
break;
}
}

var mySelect = document.getElementById("select_printerport1");

var opts = mySelect.options;
for (var opt, j = 0; opt = opts[j]; j++) {
if (opt.value == current_printerport) {
mySelect.selectedIndex = j;
break;
}
}

var mySelect = document.getElementById("select_hsioindex");

var opts = mySelect.options;
for (var opt, j = 0; opt = opts[j]; j++) {
if (opt.value == current_hsioindex) {
mySelect.selectedIndex = j;
break;
}
}

var mySelect = document.getElementById("select_rotation_sounds");

var opts = mySelect.options;
for (var opt, j = 0; opt = opts[j]; j++) {
if (opt.value == current_rotation_sounds) {
mySelect.selectedIndex = j;
break;
}
}

function changeTz() {
var sel = document.getElementById("select_tz").value;
document.getElementById("txt_timezone").value = sel;
Expand All @@ -46,3 +6,21 @@ function changeTz() {
function writeLocaleNumber(num) {
document.write(num.toLocaleString());
}

function selectListValue(selectName, currentValue) {
var mySelect = document.getElementById(selectName);
var opts = mySelect.options;

for (var opt, j = 0; opt = opts[j]; j++) {
if (opt.value == currentValue) {
mySelect.selectedIndex = j;
break;
}
}
}

selectListValue("select_printermodel1", current_printer);
selectListValue("select_printerport1", current_printerport);
selectListValue("select_hsioindex", current_hsioindex);
selectListValue("select_rotation_sounds", current_rotation_sounds);
selectListValue("select_config_enable", current_config_enabled);
34 changes: 17 additions & 17 deletions include/version.h
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/*
This file is automatically modified by the build_version.py script
to update the BUILD and BUILD_DATE values based on the
current Git commit ID and current UTC date/time.

FN_VERSION_MAJOR and FN_VERSION_MINOR should be manually updated
as needed.
*/

#define FN_VERSION_MAJOR 0
#define FN_VERSION_MINOR 5

#define FN_VERSION_BUILD "c39d8705"

#define FN_VERSION_DATE "2020-11-01 14:09:36"

#define FN_VERSION_FULL "0.5.c39d8705"
/*
This file is automatically modified by the build_version.py script
to update the BUILD and BUILD_DATE values based on the
current Git commit ID and current UTC date/time.
FN_VERSION_MAJOR and FN_VERSION_MINOR should be manually updated
as needed.
*/
#define FN_VERSION_MAJOR 0
#define FN_VERSION_MINOR 5
#define FN_VERSION_BUILD "eb50ea32"
#define FN_VERSION_DATE "2020-11-15 03:52:03"
#define FN_VERSION_FULL "0.5.eb50ea32"
14 changes: 14 additions & 0 deletions lib/config/fnConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ void fnConfig::store_general_rotation_sounds(bool rotation_sounds)
_dirty = true;
}

void fnConfig::store_general_config_enabled(bool config_enabled)
{
if (_general.config_enabled == config_enabled)
return;

_general.config_enabled = config_enabled;
_dirty = true;
}

void fnConfig::store_general_hsioindex(int hsio_index)
{
if (_general.hsio_index == hsio_index)
Expand Down Expand Up @@ -313,6 +322,7 @@ void fnConfig::save()
ss << "devicename=" << _general.devicename << LINETERM;
ss << "hsioindex=" << _general.hsio_index << LINETERM;
ss << "rotationsounds=" << _general.rotation_sounds << LINETERM;
ss << "configenabled=" << _general.config_enabled << LINETERM;
if (_general.timezone.empty() == false)
ss << "timezone=" << _general.timezone << LINETERM;

Expand Down Expand Up @@ -558,6 +568,10 @@ void fnConfig::_read_section_general(std::stringstream &ss)
{
_general.rotation_sounds = util_string_value_is_true(value);
}
else if (strcasecmp(name.c_str(), "configenabled") == 0)
{
_general.config_enabled = util_string_value_is_true(value);
}
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions lib/config/fnConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ class fnConfig
std::string get_general_timezone() { return _general.timezone; };
bool get_general_rotation_sounds() { return _general.rotation_sounds; };
std::string get_network_midimaze_host() { return _network.midimaze_host; };
bool get_general_config_enabled() { return _general.config_enabled; };
void store_general_devicename(const char *devicename);
void store_general_hsioindex(int hsio_index);
void store_general_timezone(const char *timezone);
void store_general_rotation_sounds(bool rotation_sounds);
void store_general_config_enabled(bool config_enabled);
void store_midimaze_host(const char host_ip[64]);

const char * get_network_sntpserver() { return _network.sntpserver; };
Expand Down Expand Up @@ -183,6 +185,7 @@ class fnConfig
int hsio_index = HSIO_INVALID_INDEX;
std::string timezone;
bool rotation_sounds = true;
bool config_enabled = true;
};

struct modem_info
Expand Down
14 changes: 14 additions & 0 deletions lib/http/httpServiceConfigurator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,16 @@ void fnHttpServiceConfigurator::config_rotation_sounds(std::string rotation_soun
Config.save();
}

void fnHttpServiceConfigurator::config_enable_config(std::string enable_config)
{
Debug_printf("New CONFIG enable value: %s\n", enable_config.c_str());

// Store our change in Config
Config.store_general_config_enabled(util_string_value_is_true(enable_config));
// Save change
Config.save();
}

void fnHttpServiceConfigurator::config_cassette(std::string play_record)
{
Debug_printf("New play/record button value: %s\n", play_record.c_str());
Expand Down Expand Up @@ -285,6 +295,10 @@ int fnHttpServiceConfigurator::process_config_post(const char * postdata, size_t
{
config_rotation_sounds(i->second);
}
else if (i->first.compare("config_enable") == 0)
{
config_enable_config(i->second);
}
}

return 0;
Expand Down
1 change: 1 addition & 0 deletions lib/http/httpServiceConfigurator.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class fnHttpServiceConfigurator
static void config_midimaze(std::string host_ip);
static void config_cassette(std::string play_record);
static void config_rotation_sounds(std::string rotation_sounds);
static void config_enable_config(std::string enable_config);

public:
static char * url_decode(char * dst, const char * src, size_t dstsize);
Expand Down
7 changes: 6 additions & 1 deletion lib/http/httpServiceParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const string fnHttpServiceParser::substitute_tag(const string &tag)
FN_SIO_HSBAUD,
FN_PRINTER1_MODEL,
FN_PRINTER1_PORT,
FN_CONFIG_ENABLED,
FN_LASTTAG
};

Expand Down Expand Up @@ -80,7 +81,8 @@ const string fnHttpServiceParser::substitute_tag(const string &tag)
"FN_SIO_HSINDEX",
"FN_SIO_HSBAUD",
"FN_PRINTER1_MODEL",
"FN_PRINTER1_PORT"
"FN_PRINTER1_PORT",
"FN_CONFIG_ENABLED"
};

stringstream resultstream;
Expand Down Expand Up @@ -184,6 +186,9 @@ const string fnHttpServiceParser::substitute_tag(const string &tag)
case FN_PRINTER1_PORT:
resultstream << (fnPrinters.get_port(0) + 1);
break;
case FN_CONFIG_ENABLED:
resultstream << Config.get_general_config_enabled();
break;
default:
resultstream << tag;
break;
Expand Down
3 changes: 3 additions & 0 deletions lib/sio/fuji.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1294,6 +1294,9 @@ void sioFuji::setup(sioBus *siobus)
_bootDisk.is_config_device = true;
_bootDisk.device_active = false;

// Disable booting from CONFIG if our settings say to turn it off
boot_config = Config.get_general_config_enabled();

// Add our devices to the SIO bus
for (int i = 0; i < MAX_DISK_DEVICES; i++)
_sio_bus->addDevice(&_fnDisks[i].disk_dev, SIO_DEVICEID_DISK + i);
Expand Down