From 0a86483027f82c583d15f8da908f1dbefb875166 Mon Sep 17 00:00:00 2001 From: Petr Mikhalicin Date: Sun, 7 Jul 2024 23:25:45 +0500 Subject: [PATCH] Add modes for split grading --- README.md | 1 + README_RU.md | 3 +- src/Modes/FStopTestMode.cpp | 53 ++++++++++++++++++++++++++++++------ src/Modes/FStopTestMode.h | 8 ++++-- src/Modes/LinearTestMode.cpp | 47 ++++++++++++++++++++++++++------ src/Modes/LinearTestMode.h | 8 ++++-- src/main.cpp | 12 ++++++-- 7 files changed, 105 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 551390b..a842c60 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ 2. Linear test mode: simple mode for linear testing 3. Print mode: ability to stop printing at any time. Usefull for getting fast masking values 4. Mask mode: for printing with accurate masks +4. Split grade test modes: the same as fstop and linear test modes, but allows to set base time ## Killer features: diff --git a/README_RU.md b/README_RU.md index 6c1bef1..4072429 100644 --- a/README_RU.md +++ b/README_RU.md @@ -22,12 +22,13 @@ 5. Возможность стартовать с настроек 6. Дефолтный вид в тестовых режимах и режиме маскирования (обычный вид/вид через лог) -## Режими +## Режимы 1. Тест F стопами: позволяет произвести быстрый тест для подбора тона изображения повышая каждый следующий тест на заданный тон. Размер тона можно уменьшать. После печати вы можете посмотреть лог печати 2. Линейный тест: Задается начальное значение и шаг 3. Режим печати: можете задать время и печатать с ним. Дополнительно есть возможность остановки печати и печати по удержанию кнопки (удобно для маскирования и коротких выдержках). 4. Режим маскирования: задайте количество масок и время, которое нужено для засветки определенной маски +4. Сплит грейд тесты: аналогичны тестам F стопами и линейным тестам, но с возможностью выставить начальное время экспонирования (время засветки первым фильтром) ## Killer фичи: diff --git a/src/Modes/FStopTestMode.cpp b/src/Modes/FStopTestMode.cpp index d4ff4c1..d126f09 100644 --- a/src/Modes/FStopTestMode.cpp +++ b/src/Modes/FStopTestMode.cpp @@ -6,22 +6,32 @@ namespace { constexpr uint8_t kFStopPartVarinatns[] = { 6, 5, 4, 3, 2, 1 }; } // namespace -FStopTestMode::FStopTestMode() { +FStopTestMode::FStopTestMode(bool splitGrade) : kSplit(splitGrade) { + m_baseTime = 20_ts; m_initTime = 20_ts; m_FStopPartId = 5; - m_step = Step::initTime; + m_step = kSplit ? Step::baseTime : Step::initTime; m_view = gSettings.logViewInTests ? RunView::log : RunView::common; - m_currentRun = 0; + m_currentRun = kSplit ? 0 : 1; } void FStopTestMode::switchMode() { m_step = ADD_TO_ENUM(Step, m_step, 1); - m_currentRun = 0; + if (m_step == Step::baseTime && !kSplit) + m_step = Step::initTime; + + m_currentRun = kSplit ? 0 : 1; gTimer.reset(); } void FStopTestMode::process() { switch (m_step) { + case Step::baseTime: + gDisplay[0] << preview(); + + getTime(m_baseTime); + gDisplay[1] << "Base t:" << m_baseTime; + return; case Step::initTime: gDisplay[0] << preview(); @@ -41,7 +51,10 @@ void FStopTestMode::process() { switch (m_view) { case RunView::common: - gDisplay[0] << "Test #" << m_currentRun + 1 << " T:" << gTimer.total(); + if (m_currentRun == 0) + gDisplay[0] << "Base printing"; + else + gDisplay[0] << "Test #" << m_currentRun << " T:" << gTimer.total(); gDisplay[1] >> "f 1/" >> kFStopPartVarinatns[m_FStopPartId]; @@ -64,20 +77,26 @@ void FStopTestMode::process() { if (gTimer.state() == Timer::STOPPED && gStartBtn.click()) gTimer.start(getPrintTime()); - if (gTimer.stopped()) + if (gTimer.stopped()) { + if (m_currentRun == 0) // don't take into account base time + gTimer.reset(); ++m_currentRun; + } } Time FStopTestMode::getPrintTime() const { if (m_currentRun == 0) + return m_baseTime; + + if (m_currentRun == 1) return m_initTime; float stopPart = kFStopPartVarinatns[m_FStopPartId]; - return m_initTime * (pow(2, m_currentRun / stopPart) - pow(2, (m_currentRun - 1) / stopPart)); + return m_initTime * (pow(2, (m_currentRun - 1) / stopPart) - pow(2, (m_currentRun - 2) / stopPart)); } void FStopTestMode::reset() { - m_currentRun = 0; + m_currentRun = kSplit ? 0 : 1; } void FStopTestMode::switchView() { @@ -101,11 +120,21 @@ void FStopTestMode::printLog(bool& logOverFlowed) const { auto this_ = reinterpret_cast(this__); float stopPart = kFStopPartVarinatns[this_->m_FStopPartId]; + if (!this_->kSplit) + ++id; + current = this_->m_step == Step::run && this_->m_currentRun == id; - return { this_->m_initTime * pow(2, id / stopPart) }; + + if (id == 0) + return this_->m_baseTime; + + return { this_->m_initTime * pow(2, (id - 1) / stopPart) }; }, this); + if (!kSplit) + ++id; + if (m_step == Step::run && m_currentRun >= id) logOverFlowed = true; } @@ -116,3 +145,9 @@ void FStopTestMode::printLog() const { bool unused; printLog(unused); } + +const char* FStopTestMode::preview() const { + if (kSplit) + return "Splt F Stop test"; + return "F Stop test"; +} diff --git a/src/Modes/FStopTestMode.h b/src/Modes/FStopTestMode.h index 2f8b41d..fe8f082 100644 --- a/src/Modes/FStopTestMode.h +++ b/src/Modes/FStopTestMode.h @@ -5,11 +5,11 @@ #include "../Time.h" class FStopTestMode final : public ModeProcessor { - enum class Step { initTime, fstopSet, run, last_ }; + enum class Step { baseTime, initTime, fstopSet, run, last_ }; enum class RunView { common, log, last_ }; public: - FStopTestMode(); + FStopTestMode(bool splitGrade); void process() override; void reset() override; void switchMode() override; @@ -19,15 +19,17 @@ class FStopTestMode final : public ModeProcessor { void printLog() const override; - const char* preview() const override { return "F Stop test"; } + const char* preview() const override; private: void printLog(bool& logOverFlowed) const; Time getPrintTime() const; + bool kSplit; Step m_step; RunView m_view; uint8_t m_currentRun; uint8_t m_FStopPartId; + Time m_baseTime; Time m_initTime; }; diff --git a/src/Modes/LinearTestMode.cpp b/src/Modes/LinearTestMode.cpp index 02d7793..0a46fd4 100644 --- a/src/Modes/LinearTestMode.cpp +++ b/src/Modes/LinearTestMode.cpp @@ -2,22 +2,28 @@ #include "../Tools.h" -LinearTestMode::LinearTestMode() { +LinearTestMode::LinearTestMode(bool splitGrade) : kSplit(splitGrade) { + m_baseTime = 20_ts; m_initTime = 80_ts; m_stepTime = 20_ts; - m_step = Step::initTime; + m_step = kSplit ? Step::baseTime : Step::initTime; m_view = gSettings.logViewInTests ? RunView::log : RunView::common; - m_currentRun = 0; + m_currentRun = kSplit ? 0 : 1; } void LinearTestMode::switchMode() { m_step = ADD_TO_ENUM(Step, m_step, 1); - m_currentRun = 0; + m_currentRun = kSplit ? 0 : 1; gTimer.reset(); } void LinearTestMode::process() { switch (m_step) { + case Step::baseTime: + gDisplay[0] << preview(); + getTime(m_baseTime); + gDisplay[1] << "Base t:" << m_baseTime; + return; case Step::initTime: gDisplay[0] << preview(); getTime(m_initTime); @@ -34,7 +40,10 @@ void LinearTestMode::process() { switch (m_view) { case RunView::common: - gDisplay[0] << "Test #" << m_currentRun + 1 << " T:" << gTimer.total(); + if (m_currentRun == 0) + gDisplay[0] << "Base printing"; + else + gDisplay[0] << "Test #" << m_currentRun << " T:" << gTimer.total(); if (gTimer.state() == Timer::RUNNING) { gTimer.printFormatedState(); @@ -56,19 +65,25 @@ void LinearTestMode::process() { if (gTimer.state() == Timer::STOPPED && gStartBtn.click()) gTimer.start(getPrintTime()); - if (gTimer.stopped()) + if (gTimer.stopped()) { + if (m_currentRun == 0) + gTimer.reset(); ++m_currentRun; + } } Time LinearTestMode::getPrintTime() const { if (m_currentRun == 0) + return m_baseTime; + + if (m_currentRun == 1) return m_initTime; return m_stepTime; } void LinearTestMode::reset() { - m_currentRun = 0; + m_currentRun = kSplit ? 0 : 1; } void LinearTestMode::switchView() { @@ -90,12 +105,22 @@ void LinearTestMode::printLog(bool& logOverFlowed) const { uint8_t id = printLogHelper( [](const void* this__, uint8_t id, bool& current, bool& end) -> Time { auto this_ = reinterpret_cast(this__); + + if (!this_->kSplit) + ++id; + current = this_->m_step == Step::run && this_->m_currentRun == id; - return { this_->m_initTime + this_->m_stepTime * id }; + if (id == 0) + return this_->m_baseTime; + + return { this_->m_initTime + this_->m_stepTime * (id - 1) }; }, this); + if (!kSplit) + ++id; + if (m_step == Step::run && m_currentRun >= id) logOverFlowed = true; } @@ -106,3 +131,9 @@ void LinearTestMode::printLog() const { bool unused; printLog(unused); } + +const char* LinearTestMode::preview() const { + if (kSplit) + return "Splt linear test"; + return "Linear test"; +} diff --git a/src/Modes/LinearTestMode.h b/src/Modes/LinearTestMode.h index dd1d495..0f549dc 100644 --- a/src/Modes/LinearTestMode.h +++ b/src/Modes/LinearTestMode.h @@ -5,11 +5,11 @@ #include "../Time.h" class LinearTestMode final : public ModeProcessor { - enum class Step { initTime, stepTime, run, last_ }; + enum class Step { baseTime, initTime, stepTime, run, last_ }; enum class RunView { common, log, last_ }; public: - LinearTestMode(); + LinearTestMode(bool splitGrade); void process() override; void reset() override; void switchMode() override; @@ -19,15 +19,17 @@ class LinearTestMode final : public ModeProcessor { void printLog() const override; - const char* preview() const override { return "Linear test"; } + const char* preview() const override; private: void printLog(bool& logOverFlowed) const; Time getPrintTime() const; + bool kSplit; Step m_step; RunView m_view; uint8_t m_currentRun; + Time m_baseTime; Time m_initTime; Time m_stepTime; }; diff --git a/src/main.cpp b/src/main.cpp index 42c8f33..324dc0d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -11,7 +11,7 @@ #include "SettingsSetter.h" -enum class ModeId : uint8_t { testFStops, testLinear, print, mask, last_ }; +enum class ModeId : uint8_t { testFStops, testLinear, print, mask, splitFStops, splitLinear, last_ }; ModeId gModeId; ModeProcessor* gModeProcessor = nullptr; @@ -24,10 +24,10 @@ void setMode(ModeId modeId) { switch (gModeId) { case ModeId::testFStops: - gModeProcessor = new FStopTestMode(); + gModeProcessor = new FStopTestMode(false); break; case ModeId::testLinear: - gModeProcessor = new LinearTestMode(); + gModeProcessor = new LinearTestMode(false); break; case ModeId::print: gModeProcessor = new PrintMode(); @@ -35,6 +35,12 @@ void setMode(ModeId modeId) { case ModeId::mask: gModeProcessor = new MaskMode(); break; + case ModeId::splitFStops: + gModeProcessor = new FStopTestMode(true); + break; + case ModeId::splitLinear: + gModeProcessor = new LinearTestMode(true); + break; } }