Skip to content

Commit

Permalink
Add modes for split grading
Browse files Browse the repository at this point in the history
  • Loading branch information
lo1ol committed Jul 8, 2024
1 parent 76ae0c6 commit 0a86483
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 27 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
3 changes: 2 additions & 1 deletion README_RU.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@
5. Возможность стартовать с настроек
6. Дефолтный вид в тестовых режимах и режиме маскирования (обычный вид/вид через лог)

## Режими
## Режимы

1. Тест F стопами: позволяет произвести быстрый тест для подбора тона изображения повышая каждый следующий тест на заданный тон. Размер тона можно уменьшать. После печати вы можете посмотреть лог печати
2. Линейный тест: Задается начальное значение и шаг
3. Режим печати: можете задать время и печатать с ним. Дополнительно есть возможность остановки печати и печати по удержанию кнопки (удобно для маскирования и коротких выдержках).
4. Режим маскирования: задайте количество масок и время, которое нужено для засветки определенной маски
4. Сплит грейд тесты: аналогичны тестам F стопами и линейным тестам, но с возможностью выставить начальное время экспонирования (время засветки первым фильтром)

## Killer фичи:

Expand Down
53 changes: 44 additions & 9 deletions src/Modes/FStopTestMode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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];

Expand All @@ -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() {
Expand All @@ -101,11 +120,21 @@ void FStopTestMode::printLog(bool& logOverFlowed) const {
auto this_ = reinterpret_cast<const FStopTestMode*>(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;
}
Expand All @@ -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";
}
8 changes: 5 additions & 3 deletions src/Modes/FStopTestMode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
};
47 changes: 39 additions & 8 deletions src/Modes/LinearTestMode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
Expand All @@ -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() {
Expand All @@ -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<const LinearTestMode*>(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;
}
Expand All @@ -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";
}
8 changes: 5 additions & 3 deletions src/Modes/LinearTestMode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
};
12 changes: 9 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -24,17 +24,23 @@ 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();
break;
case ModeId::mask:
gModeProcessor = new MaskMode();
break;
case ModeId::splitFStops:
gModeProcessor = new FStopTestMode(true);
break;
case ModeId::splitLinear:
gModeProcessor = new LinearTestMode(true);
break;
}
}

Expand Down

0 comments on commit 0a86483

Please sign in to comment.