/*************************************************************************** * Copyright (C) 2004 by Johan Maes - ON4QZ * * on4qz@telenet.be * * http://users.telenet.be/on4qz * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "robotamode.h" #include "configdialog.h" #include "dspfunctions.h" #include "imageview.h" #include "qsstvglobal.h" #include robotAMode::robotAMode(QObject *parent, const char *name) : modeBase(parent, name) { } robotAMode::~robotAMode() { } void robotAMode::init(sstvMode imode,imageView *ptr,bool tx,bool initClock) { modeBase::init(imode,ptr,tx,initClock); visibleLineLength=(((float)(lineTimeTable[9]))/10.-fp-bp-blank-syncDuration)/3.; } /*! \fn robotAMode::setupLine(int &subln,unsigned char **buf) \brief Decode a Robot 12/36 mode sstv image \param subln every line to display is divided in a number of sublines \param buf pointer to the pixel array. \return next phase off the display */ embState robotAMode::setupLine(int &subln,unsigned char **buf) { double start=0; if(lineCounter!=0) start=lineTimeTable[lineCounter-1]; switch(subln) { case 0: calcPixelPositionTable(YLINEODD,FALSE); *buf=yArray; debug("setup ylineodd samplecount=%d",sampleCounter); return PIXELS; case 1: debugPtr->state=stG1; marker=(unsigned int)round(start+blank+2*visibleLineLength); return RXWAIT; case 2: calcPixelPositionTable(REDLINE,FALSE); *buf=redArray; debug("setup red samplecount=%d",sampleCounter); return PIXELS; case 3: debugPtr->state=stFP; marker=(unsigned int)round(start+blank+3*visibleLineLength+fp); return RXWAIT; case 4: debugPtr->state=stSync; syncPosition=(unsigned int)round(lineTimeTable[lineCounter]-bp); return SYNC; case 5: debugPtr->state=stBP; marker=(unsigned int)round(lineTimeTable[lineCounter-1]); lineCounter++; return RXWAIT; case 6: calcPixelPositionTable(YLINEEVEN,FALSE); *buf=greenArray; debug("setup ylineeven samplecount=%d",sampleCounter); return PIXELS; case 7: debugPtr->state=stG1; marker=(unsigned int)round(lineTimeTable[lineCounter-1]+blank+2*visibleLineLength); return RXWAIT; case 8: calcPixelPositionTable(BLUELINE,FALSE); debug("setup blue samplecount=%d",sampleCounter); *buf=blueArray; return PIXELS; case 9: debugPtr->state=stFP; marker=(unsigned int)round(start+blank+3*visibleLineLength+fp); return RXWAIT; case 10: debug("wait sync=%d",sampleCounter); debugPtr->state=stSync; syncPosition=(unsigned int)round(lineTimeTable[lineCounter]-bp); return SYNC; case 11: debugPtr->state=stBP; marker=(unsigned int)round(lineTimeTable[lineCounter]); return RXWAIT; default: return ENDOFLINE; } } bool robotAMode::showLine() { colorConversion(yArray,lineCounter-1); colorConversion(greenArray,lineCounter); lineCounter++; if (lineCounter>=activeSSTVParam.numberOfLines) { return TRUE; } return FALSE; } void robotAMode::calcPixelPositionTable(unsigned int colorLine,bool tx) { unsigned int i; int ofx=0; if(tx) ofx=1; double start=0; if(lineCounter!=0) start=lineTimeTable[lineCounter-1]; debugPtr->state=colorLine; switch (colorLine) { case YLINEODD: case YLINEEVEN: start+=0; for(i=0;i