#include "settings_html.h" #include #include "../../datalayer/datalayer.h" String settings_processor(const String& var) { if (var == "X") { String content = ""; //Page format content += ""; // Start a new block with a specific background color content += "
"; content += "

SSID: " + String(ssid.c_str()) + "

"; content += "

Password: ########

"; /* If LilyGo used: Battery CAN channel: DISABLED / CAN / ADD-ON CAN MCP2515 / ADD-ON CAN-FD Inverter CAN channel: DISABLED / CAN / ADD-ON CAN MCP2515 / ADD-ON CAN-FD Battery#2 CAN channel: DISABLED / CAN / ADD-ON CAN MCP2515 / ADD-ON CAN-FD If Stark board used Battery CAN channel: DISABLED / CAN / CAN-FD Inverter CAN channel: DISABLED / CAN / CAN-FD Battery#2 CAN channel: DISABLED / CAN / CAN-FD */ content += "

Password: ########

"; // Close the block content += "
"; // Start a new block with a specific background color content += "
"; // Show current settings with edit buttons and input fields content += "

Battery capacity: " + String(datalayer.battery.info.total_capacity_Wh) + " Wh

"; content += "

Rescale SOC: " + String(datalayer.battery.settings.soc_scaling_active ? "" : "") + "

"; content += "

SOC max percentage: " + String(datalayer.battery.settings.max_percentage / 100.0, 1) + "

"; content += "

SOC min percentage: " + String(datalayer.battery.settings.min_percentage / 100.0, 1) + "

"; content += "

Max charge speed: " + String(datalayer.battery.info.max_charge_amp_dA / 10.0, 1) + " A

"; content += "

Max discharge speed: " + String(datalayer.battery.info.max_discharge_amp_dA / 10.0, 1) + " A

"; // Close the block content += "
"; #ifdef TEST_FAKE_BATTERY // Start a new block with blue background color content += "
"; float voltageFloat = static_cast(datalayer.battery.status.voltage_dV) / 10.0; // Convert to float and divide by 10 content += "

Fake battery voltage: " + String(voltageFloat, 1) + " V

"; // Close the block content += "
"; #endif #if defined CHEVYVOLT_CHARGER || defined NISSANLEAF_CHARGER // Start a new block with orange background color content += "
"; content += "

Charger HVDC Enabled: "; if (charger_HV_enabled) { content += ""; } else { content += ""; } content += "

"; content += "

Charger Aux12VDC Enabled: "; if (charger_aux12V_enabled) { content += ""; } else { content += ""; } content += "

"; content += "

Charger Voltage Setpoint: " + String(charger_setpoint_HV_VDC, 1) + " V

"; content += "

Charger Current Setpoint: " + String(charger_setpoint_HV_IDC, 1) + " A

"; // Close the block content += "
"; #endif content += ""; #ifdef TEST_FAKE_BATTERY content += "function editFakeBatteryVoltage(){var value=prompt('Enter new fake battery " "voltage');if(value!==null){if(value>=0&&value<=5000){var xhr=new " "XMLHttpRequest();xhr.onload=editComplete;xhr.onerror=editError;xhr.open('GET','/" "updateFakeBatteryVoltage?value='+value,true);xhr.send();}else{alert('Invalid value. Please enter a value " "between 0 and 1000');}}}"; #endif #if defined CHEVYVOLT_CHARGER || defined NISSANLEAF_CHARGER content += "function editChargerHVDCEnabled(){var value=prompt('Enable or disable HV DC output. Enter 1 for enabled, 0 " "for disabled');if(value!==null){if(value==0||value==1){var xhr=new " "XMLHttpRequest();xhr.onload=editComplete;xhr.onerror=editError;xhr.open('GET','/" "updateChargerHvEnabled?value='+value,true);xhr.send();}}else{alert('Invalid value. Please enter 1 or 0');}}"; content += "function editChargerAux12vEnabled(){var value=prompt('Enable or disable low voltage 12v auxiliary DC output. " "Enter 1 for enabled, 0 for disabled');if(value!==null){if(value==0||value==1){var xhr=new " "XMLHttpRequest();xhr.onload=editComplete;xhr.onerror=editError;xhr.open('GET','/" "updateChargerAux12vEnabled?value='+value,true);xhr.send();}else{alert('Invalid value. Please enter 1 or " "0');}}}"; content += "function editChargerSetpointVDC(){var value=prompt('Set charging voltage. Input will be validated against " "inverter and/or charger configuration parameters, but use sensible values like 200 to " "420.');if(value!==null){if(value>=0&&value<=1000){var xhr=new " "XMLHttpRequest();xhr.onload=editComplete;xhr.onerror=editError;xhr.open('GET','/" "updateChargeSetpointV?value='+value,true);xhr.send();}else{alert('Invalid value. Please enter a value between " "0 and 1000');}}}"; content += "function editChargerSetpointIDC(){var value=prompt('Set charging amperage. Input will be validated against " "inverter and/or charger configuration parameters, but use sensible values like 6 to " "48.');if(value!==null){if(value>=0&&value<=1000){var xhr=new " "XMLHttpRequest();xhr.onload=editComplete;xhr.onerror=editError;xhr.open('GET','/" "updateChargeSetpointA?value='+value,true);xhr.send();}else{alert('Invalid value. Please enter a value between " "0 and 100');}}}"; content += "function editChargerSetpointEndI(){var value=prompt('Set amperage that terminates charge as being " "sufficiently complete. Input will be validated against inverter and/or charger configuration parameters, but " "use sensible values like 1-5.');if(value!==null){if(value>=0&&value<=1000){var xhr=new " "XMLHttpRequest();xhr.onload=editComplete;xhr.onerror=editError;xhr.open('GET','/" "updateChargeEndA?value='+value,true);xhr.send();}else{alert('Invalid value. Please enter a value between 0 " "and 100');}}}"; #endif content += ""; content += ""; content += ""; return content; } return String(); }