[DO NOT MERGE] vibrator/cs40l26: Synchronize base and flip actuator F0

Calculate F0 offset using calibration data during initialization for
both Vibrator services.

Bug: 255435707
Test: Flashed to F10 with logs to verify correct offsets were
calculated.
Change-Id: I923b45967f5cae04f968178b75382584091869b8
Signed-off-by: Nathan Kulczak <nathankulczak@google.com>
This commit is contained in:
Nathan Kulczak 2022-11-07 19:29:13 +00:00
parent 23055c654e
commit c73579497f
6 changed files with 57 additions and 5 deletions

View file

@ -71,6 +71,7 @@ void HwApiBase::debug(int fd) {
HwCalBase::HwCalBase() {
std::ifstream calfile;
std::ifstream calfile_other;
auto propertyPrefix = std::getenv("PROPERTY_PREFIX");
if (propertyPrefix != NULL) {
@ -91,6 +92,20 @@ HwCalBase::HwCalBase() {
mCalData[utils::trim(key)] = utils::trim(value);
}
}
utils::fileFromEnv("CALIBRATION_FILEPATH_OTHER", &calfile_other);
for (std::string line; std::getline(calfile_other, line);) {
if (line.empty() || line[0] == '#') {
continue;
}
std::istringstream is_line(line);
std::string key, value;
if (std::getline(is_line, key, ':') && std::getline(is_line, value)) {
key = utils::trim(key) + "_other";
mCalData[key] = utils::trim(value);
}
}
}
void HwCalBase::debug(int fd) {