Skip to content

Commit

Permalink
Squashed commit of #2085
Browse files Browse the repository at this point in the history
commit e898e85
Author: Peter Feerick <peter.feerick@gmail.com>
Date:   Wed Dec 7 19:43:16 2022 +1000

    chore: Cleanup

commit e0b2b3e
Author: Peter Feerick <peter.feerick@gmail.com>
Date:   Wed Dec 7 16:30:28 2022 +1000

    fix: Updated translation files

commit 68594e6
Author: Peter Feerick <peter.feerick@gmail.com>
Date:   Wed Dec 7 16:22:03 2022 +1000

    fix: Add missing LR3 and TX12MKII, rebase cleanup

commit 55d0fa5
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Mon Oct 10 20:14:57 2022 +1100

    Companion: model edit Mixes view shows Mix name in a column for easy reference

commit ce36ca6
Author: elecpower <neilh713@tpg.com.au>
Date:   Mon Oct 10 08:38:21 2022 +1100

    cpn: refresh all model refs to LS when name changed. UI tweaks.

commit a58c3a4
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Sun Oct 9 15:27:34 2022 +1100

    display friendly LS name on viewlayout

commit 785c6b6
Author: Peter Feerick <peter.feerick@gmail.com>
Date:   Mon Sep 26 16:40:38 2022 +1000

    chore: Set codename

commit 6533374
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Sat Oct 8 19:13:51 2022 +1100

    TODO: put LS friendly name on radio output window.

commit 29b35fd
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Sat Oct 8 16:47:57 2022 +1100

    companion: dynamily populate list with LS name

commit 2fe540b
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Sat Oct 8 14:36:42 2022 +1100

    Companion: bug: display correct name

commit a54b5e4
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Sat Oct 8 14:15:27 2022 +1100

    companion: display LS friendly name in Comboxes

commit 3e8b1ab
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Thu Oct 6 20:02:19 2022 +1100

    special funcns: stop data loss in selectin new ch

commit 776ead9
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Sun Oct 2 13:00:58 2022 +1100

    logic sw & custom fn: friendly name copy & paste

commit 207650e
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Sat Oct 1 22:40:40 2022 +1000

    Companion: custom function Friendly Name Label

commit 45b0b7b
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Sat Oct 1 15:29:57 2022 +1000

    Companion: new Logic Switch & Friendly Name Label

commit f380a35
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Sat Oct 1 15:25:50 2022 +1000

    storage conversions for Logic switch Safe

commit 52601fd
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Sat Oct 1 15:22:15 2022 +1000

    bug: re enabled logic switch sticky.

commit 7c19f89
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Sat Oct 1 05:16:05 2022 +0000

    print logic switch safe

commit 42331d9
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Mon Jun 20 14:30:37 2022 +1000

    translations non English Texts

    (cherry picked from commit 8ee9c82)

commit 19cdbfd
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Tue Jun 14 07:56:37 2022 +0000

    update gui for new logic switch type

    (cherry picked from commit 6fd47d7)

commit 5a631cd
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Tue Jun 14 01:14:20 2022 +0000

    removed AndSw for Logic Switch mode Safe

    (cherry picked from commit 0d95f2f)

commit c7c7512
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Tue Jun 14 01:04:56 2022 +0000

    evaluation logic for LogicSwitchFunctionSafe: disassociates the AndSwitch from affecting the new Logic Switch Type

    (cherry picked from commit 62a3fd1)

commit 3da59ea
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Mon Jun 13 02:26:14 2022 +0000

    new logic switch type Safe graphical display

    (cherry picked from commit c3f1a32)

commit 90d27e7
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Sun Jun 12 23:09:38 2022 +0000

    English translations

commit 767b765
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Sun Jun 12 22:49:41 2022 +0000

    new logical switch function in dropdown

    (cherry picked from commit 5b165c0)

commit d1ae63d
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Sun Jun 12 22:47:00 2022 +0000

    new logic switch family

    (cherry picked from commit 514a60e)

commit 195c325
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Tue Jun 7 15:56:55 2022 +1000

    radio\src\gui\colorlcd\special_functions.cpp

    changed variable from  translation to dynamic string

    (cherry picked from commit 1d4a0f42b4e642389948a7e5b582545b450c78a9)

commit b372cd3
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Tue Jun 7 15:26:25 2022 +1000

    Update en.h

    re enabled definition inorder to compile simu

    (cherry picked from commit 2ca101cef51a132fd4d5c662792b2b508e99263d)

commit 41782df
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Tue Jun 7 15:19:45 2022 +1000

    radio\src\translations\en.h

    moved translations to txt file as requested by @eshifri

    (cherry picked from commit d10f5d634f10ca8eecf79f1ceef6c9b43554cee4)

commit ba8a0f7
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Tue Jun 7 15:04:23 2022 +1000

    Update special_functions.cpp

    changed variable from string to translation

    (cherry picked from commit 65df17bf1f03ab53fef98f1309b743234babd517)

commit 39661a0
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Sun Jun 5 09:34:03 2022 +1000

    Update special_functions.cpp

    fixed string changed to translation

    (cherry picked from commit 52366eed73004b1dea153dff35bd45a0f993a35e)

commit 114c69d
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Sun Jun 5 09:01:28 2022 +1000

    Update translations.cpp

    variable for model special function custom name

    (cherry picked from commit a8c494285d774c0d2268dd96ed615a957e3767c9)

commit 843ae4d
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Sun Jun 5 08:51:21 2022 +1000

    Update en.h

    in special functions edit screen, variable data for English translation

    (cherry picked from commit 82490e34094ea0ed740e58bcffe95ad66d084ca7)

commit 9d588e6
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Sun Jun 5 07:56:55 2022 +1000

    Update special_functions.cpp

    removed code comment

    (cherry picked from commit 391ad2f44d538c594e278e6be4bfc49714a5ff40)

commit 00030de
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Sat Jun 4 21:11:28 2022 +1000

    Update special_functions.cpp

    paint special function custom name

    (cherry picked from commit 59fc7c1938cd9cea8618d7b80af9c70a96cf0921)

commit 5c16aef
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Sat Jun 4 20:52:24 2022 +1000

    Update yaml_datastructs_funcs.cpp

    increase data size

    (cherry picked from commit 98276f4d3f1aab8ad4f699349ec7659df5f5225a)

commit 13581d1
Author: shane-droid <61736830+shane-droid@users.noreply.github.com>
Date:   Thu Jun 2 21:34:58 2022 +1000

    special functions gui
  • Loading branch information
pfeerick committed Aug 6, 2024
1 parent 687b28d commit 27cd498
Show file tree
Hide file tree
Showing 53 changed files with 490 additions and 202 deletions.
3 changes: 3 additions & 0 deletions companion/src/firmwares/customfunctiondata.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#include <QtCore>
#include <QComboBox>

#define CF_CUSTNAME_LEN 10

class Firmware;
class ModelData;
class GeneralSettings;
Expand Down Expand Up @@ -106,6 +108,7 @@ class CustomFunctionData {
unsigned int enabled; // TODO perhaps not any more the right name
unsigned int adjustMode;
int repeatParam;
char custName[CF_CUSTNAME_LEN + 1];

void convert(RadioDataConversionState & cstate);

Expand Down
4 changes: 4 additions & 0 deletions companion/src/firmwares/edgetx/yaml_customfunctiondata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ Node convert<CustomFunctionData>::encode(const CustomFunctionData& rhs)
node["def"] = def;
}

node["custName"] = rhs.custName;

return node;
}

Expand All @@ -252,6 +254,8 @@ bool convert<CustomFunctionData>::decode(const Node& node,
{
node["swtch"] >> rhs.swtch;

node["custName"] >> rhs.custName;

int func = 0;
node["func"] >> customFnLut >> func;
rhs.func = (AssignFunc)func;
Expand Down
18 changes: 17 additions & 1 deletion companion/src/firmwares/edgetx/yaml_logicalswitchdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ static const YamlLookupTable funcLut = {
{LS_FN_DAPOS, "FUNC_ADIFFEGREATER"},
{LS_FN_TIMER, "FUNC_TIMER"},
{LS_FN_STICKY, "FUNC_STICKY"},
{LS_FN_SAFE, "FUNC_SAFE"},
};

static int timerValue2lsw(uint32_t t)
Expand Down Expand Up @@ -80,6 +81,12 @@ Node convert<LogicalSwitchData>::encode(const LogicalSwitchData& rhs)
def += YamlRawSwitchEncode(RawSwitch(rhs.val2));
} break;

case LS_FAMILY_SAFE: {
def += YamlRawSwitchEncode(RawSwitch(rhs.val1));
def += ",";
def += YamlRawSwitchEncode(RawSwitch(rhs.val2));
} break;

case LS_FAMILY_EDGE: {
def += YamlRawSwitchEncode(RawSwitch(rhs.val1));
def += ",";
Expand Down Expand Up @@ -119,14 +126,15 @@ Node convert<LogicalSwitchData>::encode(const LogicalSwitchData& rhs)
node["andsw"] = YamlRawSwitchEncode(RawSwitch(rhs.andsw));
node["lsPersist"] = (int)rhs.lsPersist;
node["lsState"] = (int)rhs.lsState;

node["custName"] = rhs.custName;
return node;
}

bool convert<LogicalSwitchData>::decode(const Node& node,
LogicalSwitchData& rhs)
{
node["func"] >> funcLut >> rhs.func;
node["custName"] >> rhs.custName;

std::string def_str;
node["def"] >> def_str;
Expand All @@ -142,6 +150,14 @@ bool convert<LogicalSwitchData>::decode(const Node& node,
rhs.val2 = YamlRawSwitchDecode(sw_str).toValue();
} break;

case LS_FAMILY_SAFE: {
std::string sw_str;
getline(def, sw_str, ',');
rhs.val1 = YamlRawSwitchDecode(sw_str).toValue();
getline(def, sw_str);
rhs.val2 = YamlRawSwitchDecode(sw_str).toValue();
} break;

case LS_FAMILY_EDGE: {
std::string sw_str;
getline(def, sw_str, ',');
Expand Down
12 changes: 10 additions & 2 deletions companion/src/firmwares/logicalswitchdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

bool LogicalSwitchData::isEmpty() const
{
return (func == 0);
return (func == LS_FN_OFF);
}

CSFunctionFamily LogicalSwitchData::getFunctionFamily() const
Expand All @@ -39,6 +39,8 @@ CSFunctionFamily LogicalSwitchData::getFunctionFamily() const
return LS_FAMILY_TIMER;
else if (func == LS_FN_STICKY)
return LS_FAMILY_STICKY;
else if (func == LS_FN_SAFE)
return LS_FAMILY_SAFE;
else if (func < LS_FN_AND || func > LS_FN_ELESS)
return LS_FAMILY_VOFS;
else if (func < LS_FN_EQUAL)
Expand Down Expand Up @@ -103,6 +105,8 @@ QString LogicalSwitchData::funcToString() const
return tr("Timer");
case LS_FN_STICKY:
return tr("Sticky");
case LS_FN_SAFE:
return tr("Safe");
case LS_FN_EDGE:
return tr("Edge");
default:
Expand All @@ -112,7 +116,7 @@ QString LogicalSwitchData::funcToString() const

QString LogicalSwitchData::nameToString(int index) const
{
return RadioData::getElementName(tr("L"), index + 1, NULL, true);
return RadioData::getElementName(tr("L"), index + 1, custName, true);
}

void LogicalSwitchData::convert(RadioDataConversionState & cstate)
Expand All @@ -125,6 +129,10 @@ void LogicalSwitchData::convert(RadioDataConversionState & cstate)
val1 = RawSource(val1).convert(cstate.withComponentField("V1")).toValue();
break;
case LS_FAMILY_STICKY:
case LS_FAMILY_SAFE:
val1 = RawSwitch(val1).convert(cstate.withComponentField("V1")).toValue();
val2 = RawSwitch(val2).convert(cstate.withComponentField("V2")).toValue();
break;
case LS_FAMILY_VBOOL:
val1 = RawSwitch(val1).convert(cstate.withComponentField("V1")).toValue();
val2 = RawSwitch(val2).convert(cstate.withComponentField("V2")).toValue();
Expand Down
13 changes: 8 additions & 5 deletions companion/src/firmwares/logicalswitchdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
* GNU General Public License for more details.
*/

#ifndef LOGICALSWITCHDATA_H
#define LOGICALSWITCHDATA_H
#pragma once

#include <QtCore>

#define LS_CUSTNAME_LEN 10

class RadioDataConversionState;

enum CSFunction {
Expand All @@ -48,8 +49,10 @@ enum CSFunction {
LS_FN_TIMER,
LS_FN_STICKY,
LS_FN_EDGE,
LS_FN_SAFE,
// later ... LS_FN_RANGE,
LS_FN_MAX
LS_FN_MAX,

};

enum CSFunctionFamily {
Expand All @@ -59,6 +62,7 @@ enum CSFunctionFamily {
LS_FAMILY_TIMER,
LS_FAMILY_STICKY,
LS_FAMILY_EDGE,
LS_FAMILY_SAFE,
};

class LogicalSwitchData {
Expand All @@ -79,6 +83,7 @@ class LogicalSwitchData {
int andsw;
bool lsState;
bool lsPersist;
char custName[LS_CUSTNAME_LEN + 1];

void clear() { memset(this, 0, sizeof(LogicalSwitchData)); }
bool isEmpty() const;
Expand All @@ -88,5 +93,3 @@ class LogicalSwitchData {
QString nameToString(int index) const;
void convert(RadioDataConversionState & cstate);
};

#endif // LOGICALSWITCHDATA_H
6 changes: 6 additions & 0 deletions companion/src/firmwares/modeldata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,12 @@ int ModelData::updateReference()
}
break;
case LS_FAMILY_STICKY:
case LS_FAMILY_SAFE:
if (lsd->val1 != 0)
updateSwitchIntRef(lsd->val1);
if (lsd->val2 != 0)
updateSwitchIntRef(lsd->val2);
break;
case LS_FAMILY_VBOOL:
oldval1 = lsd->val1;
oldval2 = lsd->val2;
Expand Down
5 changes: 3 additions & 2 deletions companion/src/firmwares/opentx/opentxeeprom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1515,6 +1515,7 @@ class LogicalSwitchesFunctionsTable: public ConversionTable {
addConversion(LS_FN_DAPOS, val++);
addConversion(LS_FN_TIMER, val++);
addConversion(LS_FN_STICKY, val++);
addConversion(LS_FN_SAFE, val++);
}
};

Expand Down Expand Up @@ -1570,7 +1571,7 @@ class LogicalSwitchField: public TransformedField {
v2 = csw.val2;
v3 = csw.val3;
}
else if ((csw.func >= LS_FN_AND && csw.func <= LS_FN_XOR) || csw.func == LS_FN_STICKY) {
else if ((csw.func >= LS_FN_AND && csw.func <= LS_FN_XOR) || csw.func == LS_FN_STICKY || csw.func == LS_FN_SAFE) {
switchesConversionTable->exportValue(csw.val1, v1);
switchesConversionTable->exportValue(csw.val2, v2);
}
Expand All @@ -1595,7 +1596,7 @@ class LogicalSwitchField: public TransformedField {
csw.val2 = v2;
csw.val3 = v3;
}
else if ((csw.func >= LS_FN_AND && csw.func <= LS_FN_XOR) || csw.func == LS_FN_STICKY) {
else if ((csw.func >= LS_FN_AND && csw.func <= LS_FN_XOR) || csw.func == LS_FN_STICKY || csw.func == LS_FN_SAFE) {
switchesConversionTable->importValue(v1, csw.val1);
switchesConversionTable->importValue(v2, csw.val2);
}
Expand Down
2 changes: 1 addition & 1 deletion companion/src/firmwares/rawsource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ QString RawSource::toString(const ModelData * model, const GeneralSettings * con
return DataHelpers::getCompositeName(dfltName, custName, prefixCustomName);

case SOURCE_TYPE_CUSTOM_SWITCH:
return RawSwitch(SWITCH_TYPE_VIRTUAL, index).toString(); // RawSwitch uses 1 based index
return RawSwitch(SWITCH_TYPE_VIRTUAL, index + 1) .toString(board, generalSettings, model); // RawSwitch uses 1 based index

case SOURCE_TYPE_CYC:
return tr("CYC%1").arg(index);
Expand Down
12 changes: 11 additions & 1 deletion companion/src/firmwares/rawswitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,20 @@ QString RawSwitch::toString(Board::Type board, const GeneralSettings * const gen

case SWITCH_TYPE_VIRTUAL:
if (modelData)
return modelData->logicalSw[index].nameToString(index - 1);
return modelData->logicalSw[index - 1].nameToString(index - 1);
else
return LogicalSwitchData().nameToString(index - 1);

case SWITCH_TYPE_FUNCTIONSWITCH:
if (!Boards::getCapability(board, Board::FunctionSwitches))
return CPN_STR_UNKNOWN_ITEM;
qr = div(index - 1, 3);
if (modelData)
swName = QString(modelData->functionSwitchNames[qr.quot]).trimmed();
if (swName.isEmpty())
swName = tr("SW%1").arg(qr.quot + 1);
return swName + directionIndicators.at(qr.rem > -1 && qr.rem < directionIndicators.size() ? qr.rem : 1);

case SWITCH_TYPE_MULTIPOS_POT:
if (!Boards::getCapability(board, Board::MultiposPotsPositions))
return CPN_STR_UNKNOWN_ITEM;
Expand Down
Loading

0 comments on commit 27cd498

Please sign in to comment.