Skip to content

Commit 2b6505d

Browse files
committed
[coco] Update Becker interface on ESP
- On ESP, restart FujiNet after Becker enable/disable Serial port driver on ESP was not happy when loaded/unloaded from web server task. - On ESP, no Becker host:port setting in WebUI Default settings is to listen on all IPs (i.e. WiFi IP on FN-ESP)
1 parent e9b078c commit 2b6505d

File tree

3 files changed

+35
-17
lines changed

3 files changed

+35
-17
lines changed

data/webui/template/www/index.tmpl.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,6 +1343,13 @@ <h3 style="text-align: center;">Need help? Go to the <a href="https://github.com
13431343
{% else %}
13441344
Enable emulator connection
13451345
{% endif %}
1346+
{% if not tweaks.fujinet_pc %}
1347+
<div class="tooltip">&#9432;
1348+
<span class="tooltiptext small-text">
1349+
Reboot FujiNet after changing this value.
1350+
</span>
1351+
</div>
1352+
{% endif %}
13461353
</label>
13471354
</div>
13481355
<div class="settings-value">
@@ -1354,6 +1361,7 @@ <h3 style="text-align: center;">Need help? Go to the <a href="https://github.com
13541361
</div>
13551362
</div>
13561363
</div>
1364+
{% if tweaks.fujinet_pc %}
13571365
<div class="set">
13581366
<div class="settings-label">
13591367
<label for="boip_host">Hostname or IP [:port]</label>
@@ -1362,6 +1370,7 @@ <h3 style="text-align: center;">Need help? Go to the <a href="https://github.com
13621370
<input type="text" name="boip_host" id="boip_host" value="<%FN_BOIP_HOST%>">
13631371
</div>
13641372
</div>
1373+
{% endif %}
13651374
<hr>
13661375
<div class="settings-text">
13671376
<div>

lib/config/fnConfig.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,14 @@ class fnConfig
459459
struct boip_info
460460
{
461461
bool boip_enabled = false;
462+
#ifdef ESP_PLATFORM
463+
// CoCo: DriveWire server (listen) -> listen on all IPs by default
464+
// Atari: NetSIO hub (connect to) -> hub host/IP must be specified
465+
std::string host = "";
466+
#else
467+
// On PC, limit connections to/from local machine by default
462468
std::string host = "localhost";
469+
#endif
463470
int port = CONFIG_DEFAULT_BOIP_PORT;
464471
};
465472

lib/http/httpServiceConfigurator.cpp

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -569,50 +569,52 @@ void fnHttpServiceConfigurator::config_boip(std::string enable_boip, std::string
569569
Debug_printf("Set Bus Over IP: %s,%s\n", enable_boip.c_str(), boip_host_port.c_str());
570570

571571
// Store our change in Config
572-
if (!boip_host_port.empty())
572+
if (boip_host_port.empty())
573+
{
574+
Config.store_boip_host("");
575+
Config.store_boip_port(CONFIG_DEFAULT_BOIP_PORT);
576+
}
577+
else
573578
{
574579
std::size_t found = boip_host_port.find(':');
575580
std::string host = boip_host_port;
576581
int port = CONFIG_DEFAULT_BOIP_PORT;
577582
if (found != std::string::npos)
578583
{
579584
host = boip_host_port.substr(0, found);
580-
if (host.empty())
581-
host = "localhost";
582585
port = std::atoi(boip_host_port.substr(found+1).c_str());
583586
if (port < 1 || port > 65535)
584587
port = CONFIG_DEFAULT_BOIP_PORT;
585588
}
586-
Config.store_boip_port(port);
587589
Config.store_boip_host(host.c_str());
590+
Config.store_boip_port(port);
591+
}
588592

589-
// Update settings
593+
// Update settings (on ESP reboot is needed)
594+
#ifndef ESP_PLATFORM
590595
#if defined(BUILD_ATARI)
591-
# ifndef ESP_PLATFORM
592-
// fnSioCom is not available on Atari FN-ESP
593-
fnSioCom.set_netsio_host(Config.get_boip_host().c_str(), Config.get_boip_port());
594-
# endif
596+
fnSioCom.set_netsio_host(Config.get_boip_host().c_str(), Config.get_boip_port());
595597
#elif defined(BUILD_COCO)
596-
fnDwCom.set_becker_host(Config.get_boip_host().c_str(), Config.get_boip_port());
598+
fnDwCom.set_becker_host(Config.get_boip_host().c_str(), Config.get_boip_port());
597599
#endif
598-
}
600+
#endif
601+
599602
if (!enable_boip.empty())
600603
{
601604
Config.store_boip_enabled(util_string_value_is_true(enable_boip));
602605
}
603-
// Save changes
604-
Config.save();
605606

606-
// Apply settings
607+
// Apply settings (on ESP reboot is needed)
608+
#ifndef ESP_PLATFORM
607609
#if defined(BUILD_ATARI)
608-
# ifndef ESP_PLATFORM
609-
// fnSioCom is not available on Atari FN-ESP
610610
fnSioCom.reset_sio_port(Config.get_boip_enabled() ? SioCom::sio_mode::NETSIO : SioCom::sio_mode::SERIAL);
611-
# endif
612611
#elif defined(BUILD_COCO)
613612
fnDwCom.reset_drivewire_port(Config.get_boip_enabled() ? DwCom::dw_mode::BECKER : DwCom::dw_mode::SERIAL);
613+
#endif
614614
#endif
615615

616+
// Save changes
617+
Config.save();
616618
}
617619

618620
void fnHttpServiceConfigurator::config_pclink_enabled(std::string enabled)

0 commit comments

Comments
 (0)