Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions radio/src/io/multi_protolist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,7 @@ std::string MultiRfProtocols::getProtoLabel(unsigned int proto) const
if (status.protocolName[0] && status.isValid()) {
return std::string(status.protocolName);
} else if (proto <= MODULE_SUBTYPE_MULTI_LAST) {
char tmp[8];
getStringAtIndex(tmp, STR_MULTI_PROTOCOLS, proto);
return std::string(tmp);
return getStringAtIndex(STR_MULTI_PROTOCOLS, proto);
}
} else {
int idx = getIndex(proto);
Expand Down Expand Up @@ -322,8 +320,7 @@ void MultiRfProtocols::fillBuiltinProtos()

if (pdef->protocol == MM_RF_CUSTOM_SELECTED) break; // skip custom proto

char tmp[8];
rfProto.label = getStringAtIndex(tmp, STR_MULTI_PROTOCOLS, pdef->protocol);
rfProto.label = getStringAtIndex(STR_MULTI_PROTOCOLS, pdef->protocol);
rfProto.flags =
(pdef->failsafe ? 0x01 : 0) | (pdef->disable_ch_mapping ? 0x02 : 0);

Expand Down
5 changes: 5 additions & 0 deletions radio/src/strhelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ char *strcat_zchar(char *dest, const char *name, uint8_t size,
#endif

#if !defined(BOOT)
std::string getStringAtIndex(const char *const *s, int idx)
{
return std::string(s[idx]);
}

char *getStringAtIndex(char *dest, const char *const *s, int idx)
{
strcpy(dest, s[idx]);
Expand Down
1 change: 1 addition & 0 deletions radio/src/strhelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ void formatNumberAsString(char *buffer, const uint8_t buffer_size, int32_t val,

#if !defined(BOOT)
char *getStringAtIndex(char *dest, const char *const *s, int idx);
std::string getStringAtIndex(const char *const *s, int idx);
char *strAppendStringWithIndex(char *dest, const char *s, int idx);
#define LEN_TIMER_STRING 10 // "-00:00:00"
char *getTimerString(char *dest, int32_t tme,
Expand Down