Modernizing code. Bit more OO design than previously.
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone Build is passing
				
			This commit is contained in:
		@@ -3,22 +3,54 @@
 | 
			
		||||
DisplayProxyMAX7456::DisplayProxyMAX7456(Max7456 *osd)
 | 
			
		||||
{
 | 
			
		||||
    this->osd = osd;
 | 
			
		||||
    this->osd->init(6);
 | 
			
		||||
    clear();
 | 
			
		||||
    this->osd->setBlinkParams(_8fields, _BT_3BT);
 | 
			
		||||
 | 
			
		||||
    externalVideo(false);
 | 
			
		||||
    onScreenDisplay(true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Write a text string to the display at the given position
 | 
			
		||||
 * @param x Position along the X axis
 | 
			
		||||
 * @param y Position along the Y axis
 | 
			
		||||
 * @param text The string to print
 | 
			
		||||
 * @return Success or false
 | 
			
		||||
 */
 | 
			
		||||
bool DisplayProxyMAX7456::write(int x, int y, const char *text)
 | 
			
		||||
{
 | 
			
		||||
    this->osd->print(text, x, y);
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Clear the entire screen
 | 
			
		||||
 */
 | 
			
		||||
bool DisplayProxyMAX7456::clear()
 | 
			
		||||
{
 | 
			
		||||
    this->osd->clearScreen();
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Adjust the display offset.
 | 
			
		||||
 * Since the signal is analog the characters might be rendered outside the display area
 | 
			
		||||
 */
 | 
			
		||||
bool DisplayProxyMAX7456::setOffset(int x, int y)
 | 
			
		||||
{
 | 
			
		||||
    this->osd->setDisplayOffsets(x, y);
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool DisplayProxyMAX7456::externalVideo(bool enabled)
 | 
			
		||||
{
 | 
			
		||||
    this->osd->activateExternalVideo(enabled);
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool DisplayProxyMAX7456::onScreenDisplay(bool enabled) 
 | 
			
		||||
{
 | 
			
		||||
    this->osd->activateOSD(enabled);
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
@@ -7,11 +7,14 @@
 | 
			
		||||
class DisplayProxyMAX7456 : public DisplayProxy
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    DisplayProxyMAX7456(Max7456 *osd);
 | 
			
		||||
    explicit DisplayProxyMAX7456(Max7456 *osd);
 | 
			
		||||
 | 
			
		||||
    bool write(int x, int y, const char *text) override;
 | 
			
		||||
    bool clear() override;
 | 
			
		||||
    bool setOffset(int x, int y) override;
 | 
			
		||||
    bool externalVideo(bool enabled);
 | 
			
		||||
    bool onScreenDisplay(bool enabled);
 | 
			
		||||
 | 
			
		||||
    bool write(int x, int y, const char *text);
 | 
			
		||||
    bool clear() ;
 | 
			
		||||
    bool setOffset(int x, int y);
 | 
			
		||||
private:
 | 
			
		||||
    Max7456 *osd;
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user