sipo finished
This commit is contained in:
+10
-8
@@ -229,7 +229,6 @@ static void gex_file_preamble(IniWriter *iw, const char *filename)
|
||||
iw_hdr_comment(iw, filename);
|
||||
iw_hdr_comment(iw, "GEX v%s on %s", GEX_VERSION, GEX_PLATFORM);
|
||||
iw_hdr_comment(iw, "built %s at %s", __DATE__, __TIME__);
|
||||
iw_cmt_newline(iw);
|
||||
}
|
||||
|
||||
/** Generate a config file header (write instructions) */
|
||||
@@ -237,12 +236,15 @@ static void ini_preamble(IniWriter *iw, const char *filename)
|
||||
{
|
||||
gex_file_preamble(iw, filename);
|
||||
|
||||
iw_comment(iw, "Overwrite this file to change settings.");
|
||||
#if PLAT_LOCK_BTN
|
||||
iw_comment(iw, "Press the LOCK button to save them to Flash.");
|
||||
#else
|
||||
iw_comment(iw, "Close the LOCK jumper to save them to Flash.");
|
||||
#endif
|
||||
if (iw->tag == 0) { // tag 1 is set when exporting via the API
|
||||
iw_cmt_newline(iw);
|
||||
iw_comment(iw, "Overwrite this file to change settings.");
|
||||
#if PLAT_LOCK_BTN
|
||||
iw_comment(iw, "Press the LOCK button to save them to Flash.");
|
||||
#else
|
||||
iw_comment(iw, "Close the LOCK jumper to save them to Flash.");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// --- UNITS.INI ---
|
||||
@@ -284,7 +286,7 @@ extern void plat_print_system_pinout(IniWriter *iw);
|
||||
void settings_build_pinout_txt(IniWriter *iw)
|
||||
{
|
||||
gex_file_preamble(iw, "PINOUT.TXT");
|
||||
|
||||
iw_cmt_newline(iw);
|
||||
rsc_print_all_available(iw);
|
||||
ureg_print_unit_resources(iw);
|
||||
plat_print_system_pinout(iw);
|
||||
|
||||
+18
-11
@@ -340,19 +340,26 @@ bool ureg_finalize_all_init(void)
|
||||
} else {
|
||||
pUnit->status = pUnit->driver->init(pUnit);
|
||||
if (pUnit->status != E_SUCCESS) {
|
||||
dbg("!!! error initing unit %s: %s", pUnit->name,
|
||||
error_get_message(pUnit->status));
|
||||
dbg("!!! error initing unit %s: %s", pUnit->name, error_get_message(pUnit->status));
|
||||
}
|
||||
|
||||
// try to assign unique callsigns
|
||||
// FIXME this is wrong, sometimes leads to duplicate CS
|
||||
if (pUnit->callsign == 0) {
|
||||
pUnit->callsign = callsign++;
|
||||
}
|
||||
else {
|
||||
if (pUnit->callsign >= callsign) {
|
||||
callsign = (uint8_t) (pUnit->callsign + 1);
|
||||
}
|
||||
// this is very inefficient but should be reliable
|
||||
bool change = false;
|
||||
do {
|
||||
UlistEntry *xli = ulist_head;
|
||||
while (xli != NULL) {
|
||||
if (xli->unit.callsign != 0) {
|
||||
if (xli->unit.callsign == callsign) {
|
||||
change = true;
|
||||
callsign++;
|
||||
}
|
||||
}
|
||||
xli = xli->next;
|
||||
}
|
||||
} while (change && callsign < 255);
|
||||
pUnit->callsign = callsign;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -398,8 +405,9 @@ void ureg_build_ini(IniWriter *iw)
|
||||
|
||||
// Unit list
|
||||
iw_section(iw, "UNITS");
|
||||
iw_comment(iw, "Create units by adding their names next to a type (e.g. PIN=A,B),");
|
||||
iw_comment(iw, "Create units by adding their names next to a type (e.g. DO=A,B),");
|
||||
iw_comment(iw, "remove the same way. Reload to update the unit sections below.");
|
||||
iw_cmt_newline(iw);
|
||||
|
||||
// This could certainly be done in some more efficient way ...
|
||||
re = ureg_head;
|
||||
@@ -412,7 +420,6 @@ void ureg_build_ini(IniWriter *iw)
|
||||
|
||||
const UnitDriver *const pDriver = re->driver;
|
||||
|
||||
iw_cmt_newline(iw);
|
||||
iw_comment(iw, pDriver->description);
|
||||
iw_string(iw, pDriver->name);
|
||||
iw_string(iw, "=");
|
||||
|
||||
Reference in New Issue
Block a user