diff --git a/README.md b/README.md index d37983b..6e9b849 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ 1. F Stop test mode: ability to print tones and part tones of prints (decreasing f stop step). After that you can see the log 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. Mask mode: for printing with accurate masks. Hold extra btn while set mask to go back to first mask. Click start btn when set mask to play melody after printing this mask -- usefull, when you don't want to forgot to do something. For example, change filter. 5. Split grade test modes: the same as fstop and linear test modes, but allows to set base time. After printing base, the melody is playing to not forget change filter ## Killer features: diff --git a/README_RU.md b/README_RU.md index 78419ed..28868d3 100644 --- a/README_RU.md +++ b/README_RU.md @@ -27,7 +27,7 @@ 1. Тест F стопами: позволяет произвести быстрый тест для подбора тона изображения повышая каждый следующий тест на заданный тон. Размер тона можно уменьшать. После печати вы можете посмотреть лог печати 2. Линейный тест: Задается начальное значение и шаг 3. Режим печати: можете задать время и печатать с ним. Дополнительно есть возможность остановки печати и печати по удержанию кнопки (удобно для маскирования и коротких выдержках). -4. Режим маскирования: задайте количество масок и время, которое нужено для засветки определенной маски +4. Режим маскирования: задайте количество масок и время, которое нужено для засветки определенной маски. Удерживайте кнопку на энкодере, во время установки масок, чтобы вернуться к установке первой маски. Нажмите на кнопку старта, во время установки масок, чтобы поставить напоминание на конкретной маске. После печати маски с уведомлением проиграет милодия, которая напомнит вам сделать что-то, например, сменить фильтр 5. Сплит грейд тесты: аналогичны тестам F стопами и линейным тестам, но с возможностью выставить начальное время экспонирования (время засветки первым фильтром). После печати базового времени играет мелодия, чтобы вы не забыли сменить фильтр ## Killer фичи: diff --git a/src/Display.cpp b/src/Display.cpp index df86748..f178847 100644 --- a/src/Display.cpp +++ b/src/Display.cpp @@ -14,7 +14,7 @@ void Display::reset() { line.reset(); } -void Display::resetBlink() { +void Display::resetBlink(bool state) { for (auto&& line : m_lines) - line.resetBlink(); + line.resetBlink(state); } diff --git a/src/Display.h b/src/Display.h index dbf6469..316d3bb 100644 --- a/src/Display.h +++ b/src/Display.h @@ -13,7 +13,7 @@ class Display { void tick(); void reset(); - void resetBlink(); + void resetBlink(bool state = false); private: LiquidCrystal m_lcd; diff --git a/src/DisplayLine.cpp b/src/DisplayLine.cpp index 5abb149..14daac8 100644 --- a/src/DisplayLine.cpp +++ b/src/DisplayLine.cpp @@ -21,7 +21,7 @@ void DisplayLine::concatInt(char* dst, int value) { concat(dst, str); } -bool DisplayLine::tryPrint(const char* src, bool blink, uint8_t alignSize) { +bool DisplayLine::tryPrint(const char* src, bool blink, uint8_t alignSize, const char* mark) { uint8_t srclen = strlen(src); uint8_t dstlen = strlen(m_fwInfo); @@ -37,6 +37,9 @@ bool DisplayLine::tryPrint(const char* src, bool blink, uint8_t alignSize) { if (blink) { m_blinkLength = alignSize; m_blinkPos = dstlen; + + if (mark) + m_mark = mark; } concat(m_fwInfo, src); @@ -47,11 +50,12 @@ void DisplayLine::reset() { m_fwInfo[0] = 0; m_bwInfo[0] = 0; m_blinkLength = 0; + m_mark = 0; } -void DisplayLine::resetBlink() { +void DisplayLine::resetBlink(bool state) { m_blinkTimer = millis(); - m_blinkState = false; + m_blinkState = state; } void DisplayLine::tick() { @@ -67,8 +71,14 @@ void DisplayLine::tick() { m_blinkTimer = millis(); } - if (m_blinkState) + if (m_blinkState) { memset(m_fwInfo + m_blinkPos, ' ', m_blinkLength); + + if (m_mark) { + uint8_t marklen = strlen(m_mark); + memcpy(m_fwInfo + m_blinkPos + m_blinkLength - marklen, m_mark, marklen); + } + } } m_lcd.setCursor(0, m_line); diff --git a/src/DisplayLine.h b/src/DisplayLine.h index f3e04b0..7c680b2 100644 --- a/src/DisplayLine.h +++ b/src/DisplayLine.h @@ -12,7 +12,7 @@ class DisplayLine { void tick(); void reset(); - void resetBlink(); + void resetBlink(bool state = false); DisplayLine& operator<<(const char* src); DisplayLine& operator<<(int value); @@ -20,7 +20,7 @@ class DisplayLine { DisplayLine& operator>>(const char* src); DisplayLine& operator>>(int value); - bool tryPrint(const char* src, bool blink = false, uint8_t alignSize = 0); + bool tryPrint(const char* src, bool blink = false, uint8_t alignSize = 0, const char* mark = nullptr); private: static void concat(char* dst, const char* src); @@ -33,6 +33,7 @@ class DisplayLine { uint8_t m_blinkLength = 0; uint32_t m_blinkTimer = 0; bool m_blinkState = 0; + const char* m_mark; char m_fwInfo[DISPLAY_COLS + 1] = ""; char m_bwInfo[DISPLAY_COLS + 1] = ""; diff --git a/src/ModeProcessor.cpp b/src/ModeProcessor.cpp index 0806a87..65f446b 100644 --- a/src/ModeProcessor.cpp +++ b/src/ModeProcessor.cpp @@ -3,7 +3,8 @@ #include "Config.h" #include "Tools.h" -uint8_t ModeProcessor::printLogHelper(Time (*timeGetter)(const void* ctx, uint8_t id, bool& current, bool& end), +uint8_t ModeProcessor::printLogHelper(Time (*timeGetter)(const void* ctx, uint8_t id, bool& current, bool& end, + const char*& mark), const void* ctx) const { uint8_t id = 0; @@ -14,8 +15,9 @@ uint8_t ModeProcessor::printLogHelper(Time (*timeGetter)(const void* ctx, uint8_ bool end = false; bool printTimer = gTimer.state() == Timer::RUNNING; uint8_t alignSize = 0; + const char* mark = nullptr; - Time time = timeGetter(ctx, id, current, end); + Time time = timeGetter(ctx, id, current, end, mark); if (end) return id; @@ -32,7 +34,7 @@ uint8_t ModeProcessor::printLogHelper(Time (*timeGetter)(const void* ctx, uint8_ } } - if (!gDisplay[row].tryPrint(str, current && !printTimer, alignSize)) + if (!gDisplay[row].tryPrint(str, current && !printTimer, alignSize, mark)) break; gDisplay[row] << " "; diff --git a/src/ModeProcessor.h b/src/ModeProcessor.h index 29e0943..a0794ef 100644 --- a/src/ModeProcessor.h +++ b/src/ModeProcessor.h @@ -17,6 +17,6 @@ class ModeProcessor { virtual const char* preview() const = 0; protected: - uint8_t printLogHelper(Time (*timeGetter)(const void* ctx, uint8_t id, bool& current, bool& end), + uint8_t printLogHelper(Time (*timeGetter)(const void* ctx, uint8_t id, bool& current, bool& end, const char*& mark), const void* ctx) const; }; diff --git a/src/Modes/FStopTestMode.cpp b/src/Modes/FStopTestMode.cpp index 6144343..2f3b3c0 100644 --- a/src/Modes/FStopTestMode.cpp +++ b/src/Modes/FStopTestMode.cpp @@ -118,7 +118,7 @@ bool FStopTestMode::canSwitchView() const { void FStopTestMode::printLog(bool& logOverFlowed) const { uint8_t id = printLogHelper( - [](const void* this__, uint8_t id, bool& current, bool& end) -> Time { + [](const void* this__, uint8_t id, bool& current, bool& end, const char*& mark) -> Time { auto this_ = reinterpret_cast(this__); float stopPart = kFStopPartVarinatns[this_->m_FStopPartId]; diff --git a/src/Modes/LinearTestMode.cpp b/src/Modes/LinearTestMode.cpp index 7509f0e..0604bcf 100644 --- a/src/Modes/LinearTestMode.cpp +++ b/src/Modes/LinearTestMode.cpp @@ -105,7 +105,7 @@ bool LinearTestMode::canSwitchView() const { void LinearTestMode::printLog(bool& logOverFlowed) const { uint8_t id = printLogHelper( - [](const void* this__, uint8_t id, bool& current, bool& end) -> Time { + [](const void* this__, uint8_t id, bool& current, bool& end, const char*& mark) -> Time { auto this_ = reinterpret_cast(this__); if (!this_->kSplit) diff --git a/src/Modes/MaskMode.cpp b/src/Modes/MaskMode.cpp index df890b8..04503a2 100644 --- a/src/Modes/MaskMode.cpp +++ b/src/Modes/MaskMode.cpp @@ -9,6 +9,7 @@ MaskMode::MaskMode() { m_step = Step::setNum; m_view = gSettings.logViewInMasks ? View::log : View::common; m_currentMask = 0; + m_notifyMask = 0; for (uint8_t i = 1; i != kMasksMaxNumber; ++i) m_masks[i] = -1_ts; @@ -22,6 +23,7 @@ void MaskMode::switchMode() { m_currentMask = 0; + m_notifyMask &= ~((~0) << m_notifyMask); for (uint8_t i = m_numberOfMasks; i != kMasksMaxNumber; ++i) m_masks[i] = -1_ts; @@ -60,12 +62,19 @@ void MaskMode::process() { } void MaskMode::processSetMasks() { + if (gStartBtn.click()) { + m_notifyMask ^= 1 << m_currentMask; + gDisplay.resetBlink(true); + } + bool changed = getTime(m_masks[m_currentMask]); switch (m_view) { case View::common: gDisplay[0] << "Mask set: #" << (m_currentMask + 1); gDisplay[1] << m_masks[m_currentMask]; + if (m_notifyMask & (1 << m_currentMask)) + gDisplay[1] >> "Notify"; break; case View::log: { if (changed) @@ -86,6 +95,9 @@ void MaskMode::processRun() { case View::common: gDisplay[0] << "Mask #" << m_currentMask + 1 << " T:" << gTimer.total(); + if (m_notifyMask & (1 << m_currentMask)) + gDisplay[1] >> "Notify"; + if (gTimer.state() == Timer::RUNNING) { gTimer.printFormatedState(); } else if (m_currentMask == m_numberOfMasks) { @@ -112,8 +124,11 @@ void MaskMode::processRun() { if (gTimer.state() == Timer::STOPPED && gStartBtn.click()) gTimer.start(m_masks[m_currentMask]); - if (gTimer.stopped()) + if (gTimer.stopped()) { + if (m_notifyMask & (1 << m_currentMask)) + gBeeper.melody(); ++m_currentMask; + } } void MaskMode::reset() { @@ -137,7 +152,7 @@ bool MaskMode::canSwitchView() const { void MaskMode::printLog(bool& logOverFlowed) const { uint8_t id = printLogHelper( - [](const void* this__, uint8_t id, bool& current, bool& end) -> Time { + [](const void* this__, uint8_t id, bool& current, bool& end, const char*& mark) -> Time { auto this_ = reinterpret_cast(this__); current = this_->m_step != Step::setNum && this_->m_currentMask == id; @@ -145,6 +160,9 @@ void MaskMode::printLog(bool& logOverFlowed) const { if (end) return {}; + if (this_->m_notifyMask & (1 << id)) + mark = "ntf"; + Time time = this_->m_masks[id]; if (time == -1_ts) return 0_ts; diff --git a/src/Modes/MaskMode.h b/src/Modes/MaskMode.h index 9c3a954..b3d70cb 100644 --- a/src/Modes/MaskMode.h +++ b/src/Modes/MaskMode.h @@ -35,4 +35,5 @@ class MaskMode final : public ModeProcessor { uint8_t m_currentMask; Time m_masks[kMasksMaxNumber]; + uint16_t m_notifyMask; }; diff --git a/src/Modes/PrintMode.cpp b/src/Modes/PrintMode.cpp index 0360d8b..9ddf8b4 100644 --- a/src/Modes/PrintMode.cpp +++ b/src/Modes/PrintMode.cpp @@ -82,7 +82,7 @@ void PrintMode::printLog() const { gDisplay[0] << "Log "; printLogHelper( - [](const void* this__, uint8_t id, bool& current, bool& end) -> Time { + [](const void* this__, uint8_t id, bool& current, bool& end, const char*& mark) -> Time { auto this_ = reinterpret_cast(this__); end = id == this_->m_logSize;