|
|
@ -50,6 +50,11 @@ void UTOUCH_loadBinary(Unit *unit, PayloadParser *pp) |
|
|
|
if (version >= 1) { |
|
|
|
if (version >= 1) { |
|
|
|
priv->cfg.interlaced = pp_bool(pp); |
|
|
|
priv->cfg.interlaced = pp_bool(pp); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (version >= 2) { |
|
|
|
|
|
|
|
priv->cfg.binary_debounce_ms = pp_u16(pp); |
|
|
|
|
|
|
|
priv->cfg.binary_hysteresis = pp_u16(pp); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** Write to a binary buffer for storing in Flash */ |
|
|
|
/** Write to a binary buffer for storing in Flash */ |
|
|
@ -57,7 +62,7 @@ void UTOUCH_writeBinary(Unit *unit, PayloadBuilder *pb) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct priv *priv = unit->data; |
|
|
|
struct priv *priv = unit->data; |
|
|
|
|
|
|
|
|
|
|
|
pb_u8(pb, 1); // version
|
|
|
|
pb_u8(pb, 2); // version
|
|
|
|
|
|
|
|
|
|
|
|
pb_u8(pb, priv->cfg.charge_time); |
|
|
|
pb_u8(pb, priv->cfg.charge_time); |
|
|
|
pb_u8(pb, priv->cfg.drain_time); |
|
|
|
pb_u8(pb, priv->cfg.drain_time); |
|
|
@ -68,6 +73,8 @@ void UTOUCH_writeBinary(Unit *unit, PayloadBuilder *pb) |
|
|
|
pb_buf(pb, priv->cfg.group_scaps, 8); |
|
|
|
pb_buf(pb, priv->cfg.group_scaps, 8); |
|
|
|
pb_buf(pb, priv->cfg.group_channels, 8); |
|
|
|
pb_buf(pb, priv->cfg.group_channels, 8); |
|
|
|
pb_bool(pb, priv->cfg.interlaced); |
|
|
|
pb_bool(pb, priv->cfg.interlaced); |
|
|
|
|
|
|
|
pb_u16(pb, priv->cfg.binary_debounce_ms); |
|
|
|
|
|
|
|
pb_u16(pb, priv->cfg.binary_hysteresis); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
@ -99,6 +106,12 @@ error_t UTOUCH_loadIni(Unit *unit, const char *key, const char *value) |
|
|
|
else if (streq(key, "interlaced-pads")) { |
|
|
|
else if (streq(key, "interlaced-pads")) { |
|
|
|
priv->cfg.interlaced = cfg_bool_parse(value, &suc); |
|
|
|
priv->cfg.interlaced = cfg_bool_parse(value, &suc); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else if (streq(key, "btn-debounce")) { |
|
|
|
|
|
|
|
priv->cfg.binary_debounce_ms = cfg_u16_parse(value, &suc); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (streq(key, "btn-hysteresis")) { |
|
|
|
|
|
|
|
priv->cfg.binary_hysteresis = cfg_u16_parse(value, &suc); |
|
|
|
|
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
|
volatile char namebuf[10]; // must be volatile or gcc optimizes out the second compare and fucks it up
|
|
|
|
volatile char namebuf[10]; // must be volatile or gcc optimizes out the second compare and fucks it up
|
|
|
|
|
|
|
|
|
|
|
@ -152,6 +165,11 @@ void UTOUCH_writeIni(Unit *unit, IniWriter *iw) |
|
|
|
iw_comment(iw, "Optimize for interlaced pads (individual sampling with others floating)"); |
|
|
|
iw_comment(iw, "Optimize for interlaced pads (individual sampling with others floating)"); |
|
|
|
iw_entry(iw, "interlaced-pads", str_yn(priv->cfg.interlaced)); |
|
|
|
iw_entry(iw, "interlaced-pads", str_yn(priv->cfg.interlaced)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
iw_cmt_newline(iw); |
|
|
|
|
|
|
|
iw_comment(iw, "Button mode debounce (ms) and release hysteresis (lsb)"); |
|
|
|
|
|
|
|
iw_entry(iw, "btn-debounce", "%d", (int)priv->cfg.binary_debounce_ms); |
|
|
|
|
|
|
|
iw_entry(iw, "btn-hysteresis", "%d", (int)priv->cfg.binary_hysteresis); |
|
|
|
|
|
|
|
|
|
|
|
iw_cmt_newline(iw); |
|
|
|
iw_cmt_newline(iw); |
|
|
|
iw_comment(iw, "Each used group must have 1 sampling capacitor and 1-3 channels."); |
|
|
|
iw_comment(iw, "Each used group must have 1 sampling capacitor and 1-3 channels."); |
|
|
|
iw_comment(iw, "Channels are numbered 1,2,3,4"); |
|
|
|
iw_comment(iw, "Channels are numbered 1,2,3,4"); |
|
|
|