Updated build system and added page to select host mode or auto detection
This commit is contained in:
@@ -128,6 +128,9 @@ struct SharpKeyConfig {
|
||||
struct {
|
||||
uint8_t bootMode; // Flag to indicate the mode SharpKey should boot into.
|
||||
// 0 = Interface, 1 = WiFi (configured), 2 = WiFi (default).
|
||||
uint32_t hostMode; // Host machine override. 0 = Auto (detect from hardware),
|
||||
// 2500 = MZ-2500, 2800 = MZ-2800, 1 = X1, 68000 = X68000,
|
||||
// 5600 = MZ-5600/6500, 9801 = PC-9801, 2 = Mouse.
|
||||
} params;
|
||||
} sharpKeyConfig;
|
||||
|
||||
@@ -485,8 +488,15 @@ void startWiFi(NVS &nvs, LED *led, bool defaultMode, uint32_t ifMode)
|
||||
// Method to determine which host the SharpKey is connected to. This is done by examining the host I/O for tell tale signals
|
||||
// or inputs wired in a fixed combination.
|
||||
//
|
||||
uint32_t getHostType(bool eFuseInvalid, t_EFUSE sharpkeyEfuses)
|
||||
uint32_t getHostType(bool eFuseInvalid, t_EFUSE sharpkeyEfuses, uint32_t hostMode)
|
||||
{
|
||||
// If a host mode has been set via the web interface (stored in NVS), use it directly.
|
||||
if(hostMode != 0)
|
||||
{
|
||||
ESP_LOGW(MAINTAG, "Host mode set via config: %d", hostMode);
|
||||
return(hostMode);
|
||||
}
|
||||
|
||||
// Locals.
|
||||
//
|
||||
uint32_t RTSNI_MASK = (1 << (CONFIG_HOST_RTSNI - 32));
|
||||
@@ -905,6 +915,7 @@ void setup(NVS &nvs)
|
||||
{
|
||||
ESP_LOGW(SETUPTAG, "SharpKey configuration set to default, no valid config found in NVS.");
|
||||
sharpKeyConfig.params.bootMode = 0;
|
||||
sharpKeyConfig.params.hostMode = 0;
|
||||
|
||||
// Persist the data for next time.
|
||||
if(nvs.persistData(SHARPKEY_NAME, &sharpKeyConfig, sizeof(struct SharpKeyConfig)) == false)
|
||||
@@ -919,7 +930,7 @@ void setup(NVS &nvs)
|
||||
}
|
||||
|
||||
// Get the host type SharpKey is connected with.
|
||||
ifMode = getHostType(eFuseInvalid, sharpkeyEfuses);
|
||||
ifMode = getHostType(eFuseInvalid, sharpkeyEfuses, sharpKeyConfig.params.hostMode);
|
||||
|
||||
// If bootMode is for Wifi, start it. This has to be seperate due to a conflict with Bluetooth and WiFi which shares the same antenna.
|
||||
// Code is written to allow co-existence but it doesnt work so well in this project.
|
||||
|
||||
Reference in New Issue
Block a user