Skip to content

Commit

Permalink
encoders: add the option to configure repeated value
Browse files Browse the repository at this point in the history
  • Loading branch information
paradajz committed Apr 15, 2024
1 parent fd7b426 commit 79dbea6
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/firmware/application/database/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ namespace database
REMOTE_SYNC,
LOWER_LIMIT,
UPPER_LIMIT,
REPEATED_VALUE,
AMOUNT
};

Expand Down
9 changes: 9 additions & 0 deletions src/firmware/application/database/Layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,15 @@ namespace database
LESSDB::autoIncrementSetting_t::DISABLE,
16383,
},

// repeated value section
{
io::Encoders::Collection::SIZE(),
LESSDB::sectionParameterType_t::WORD,
LESSDB::preserveSetting_t::DISABLE,
LESSDB::autoIncrementSetting_t::DISABLE,
127,
},
};

std::vector<LESSDB::Section> _analogSections = {
Expand Down
1 change: 1 addition & 0 deletions src/firmware/application/system/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ namespace sys
REMOTE_SYNC,
LOWER_LIMIT,
UPPER_LIMIT,
REPEATED_VALUE,
AMOUNT
};

Expand Down
7 changes: 7 additions & 0 deletions src/firmware/application/system/Layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,13 @@ namespace sys
0,
16383,
},

// repeated value section
{
io::Encoders::Collection::SIZE(),
0,
16383,
},
};

std::vector<SysExConf::Section> _analogSections = {
Expand Down
1 change: 1 addition & 0 deletions src/firmware/application/util/conversion/Conversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ namespace util
database::Config::Section::encoder_t::REMOTE_SYNC,
database::Config::Section::encoder_t::LOWER_LIMIT,
database::Config::Section::encoder_t::UPPER_LIMIT,
database::Config::Section::encoder_t::REPEATED_VALUE,
};

static constexpr database::Config::Section::analog_t SYS_EX2_DB_ANALOG[static_cast<uint8_t>(sys::Config::Section::analog_t::AMOUNT)] = {
Expand Down
7 changes: 7 additions & 0 deletions tests/src/database/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,13 @@ TEST_F(DatabaseTest, ReadInitialValues)
DB_READ_VERIFY(16383, database::Config::Section::encoder_t::UPPER_LIMIT, i);
}

// repeated value section
// all values should be set to 127
for (size_t i = 0; i < io::Encoders::Collection::SIZE(); i++)
{
DB_READ_VERIFY(127, database::Config::Section::encoder_t::REPEATED_VALUE, i);
}

// analog block
//----------------------------------
// enable section
Expand Down

0 comments on commit 79dbea6

Please sign in to comment.