From ece7ddd95669aeeecc7851bb04ee811fa869bce2 Mon Sep 17 00:00:00 2001 From: ZXGuesser Date: Mon, 10 Aug 2020 13:34:14 +0100 Subject: [PATCH] Change C8 Update bit generation logic to be dependent on source pages. If C8 bit is set in a loaded page transmit it once and clear the bit in memory (only transmit update once). This puts the generation of update under editorial control. Previous behaviour was to generate an update bit any time a file changed (or transmit continuously if present in input file) --- packetmag.cpp | 15 ++++++++------- ttxline.cpp | 12 +----------- ttxline.h | 4 ---- ttxpage.cpp | 16 ---------------- ttxpage.h | 6 ------ 5 files changed, 9 insertions(+), 44 deletions(-) diff --git a/packetmag.cpp b/packetmag.cpp index 50bc76d..06f9c6e 100644 --- a/packetmag.cpp +++ b/packetmag.cpp @@ -173,13 +173,14 @@ Packet* PacketMag::GetPacket(Packet* p) _region=_page->GetRegion(); } - // If the page has changed, then set the update bit. - // This is by request of Nate. It isn't a feature required in ETSI - if (_page->Changed()) - { - _status|=PAGESTATUS_C8_UPDATE; - - _status|=PAGESTATUS_C4_ERASEPAGE; // also set the erase flag + // Handle pages with update bit set in a useful way. + // This isn't defined by the specification. + if (_status & PAGESTATUS_C8_UPDATE){ + // Clear update bit in stored page so that update flag is only transmitted once + _page->SetPageStatus(_status & ~PAGESTATUS_C8_UPDATE); + + // Also set the erase flag in output. This will allow left over rows in adaptive transmission to be cleared without leaving the erase flag set causing flickering. + _status|=PAGESTATUS_C4_ERASEPAGE; } } diff --git a/ttxline.cpp b/ttxline.cpp index 3cadb1e..38e878b 100644 --- a/ttxline.cpp +++ b/ttxline.cpp @@ -28,8 +28,7 @@ TTXLine::TTXLine(std::string const& line, bool validateLine): m_textline(validate(line)), - _nextLine(nullptr), - _changed(false) + _nextLine(nullptr) { if (!validateLine) @@ -49,10 +48,6 @@ TTXLine::~TTXLine() void TTXLine::Setm_textline(std::string const& val, bool validateLine) { - if (m_textline.compare(val)!=0) // changed flag is used to set the C8 flag - { - _changed=true; - } if (validateLine) m_textline = validate(val); else @@ -110,11 +105,6 @@ char TTXLine::SetCharAt(int x,int code) { char c=m_textline[x]; code=code & 0x7f; - // If the existing character is changed, then set the changed flag. - if (c!=code) - { - _changed=true; - } m_textline[x]=code; return c; } diff --git a/ttxline.h b/ttxline.h index 01bfa24..be9c609 100644 --- a/ttxline.h +++ b/ttxline.h @@ -58,8 +58,6 @@ class TTXLine void Dump(); - bool GetChanged(){bool temp=_changed;_changed=false;return temp;}; /// Get the changed status (and clear the flag) - protected: private: std::string validate(std::string const& test); @@ -67,8 +65,6 @@ class TTXLine std::string m_textline; TTXLine* _nextLine; // If SetLine or SetChar can set the changed flag. - // The changed flag is used to set the C8 flag and then is reset. - bool _changed; /// If the line contents has changed. Set by SetLine or SetChar }; diff --git a/ttxpage.cpp b/ttxpage.cpp index d5269c5..35f164e 100644 --- a/ttxpage.cpp +++ b/ttxpage.cpp @@ -67,22 +67,6 @@ TTXPage::TTXPage(std::string filename) : // std::cerr << "Finished reading page. Loaded=" << m_Loaded << std::endl; } -bool TTXPage::Changed() -{ - bool changed=_fileChanged; // begin with file change state - _fileChanged=false; // clear the flag - for (uint8_t row=1;row<=MAXROW;row++) - { - TTXLine* line=GetRow(row); - if (line!=nullptr && line->GetChanged()) - { - changed=true; - // Could break here BUT the changed state in the other rows must be cleared - } - } - return changed; -} - void TTXPage::m_Init() { m_region=0; diff --git a/ttxpage.h b/ttxpage.h index c321541..740b562 100644 --- a/ttxpage.h +++ b/ttxpage.h @@ -199,12 +199,6 @@ class TTXPage * Warning. Only deep copies the top page. Not for carousels (yet) */ void Copy(TTXPage* src); - - /** \brief Check if any line in the page has changed. - * This can only be called once as it will clear the changed state. - * This is NOT the same as pageChanged. - */ - bool Changed(); void SetFileChangedFlag(){_fileChanged=true;};