Пример #1
0
static void initDisplay(DisplayInternalInfo& displayInternalInfo) {
  int i;

  for (i=0; i < BACKGROUND_MESSAGE_COUNT; ++i) initBackgroundMessage(i);
  for (i=0; i < BACKGROUND_IMG_COUNT; ++i) initBackgroundImg(i);

  initModeMessageData(1 /*currX*/, 5 /*currY*/, false /*incrementX*/, false /*incrementY*/,
		      1 /*confetti*/, false /*blink*/, font5x4 /*font*/, 5 /*timeout*/);
  modeMessageData.modeMsgsIndex = modeMsgsIndexBoot;
  modeMessageData.displayColor = displayColorYellow;
  changeDisplayMode(displayModeMessage, displayInternalInfo);
}
    int DisplayDispatcher::setDispProp(int cmd,int param0,int param1,int param2)
    {
        switch(cmd)
        {
            case  DISPLAY_CMD_SETDISPPARA:
                return  setDisplayParameter(param0,param1,param2);

            case  DISPLAY_CMD_CHANGEDISPMODE:
                return  changeDisplayMode(param0,param1,param2);

            case  DISPLAY_CMD_CLOSEDISP:
                return  closeDisplay(param0);

            case  DISPLAY_CMD_OPENDISP:
                return  openDisplay(param0);

            case  DISPLAY_CMD_GETDISPCOUNT:
                return  getDisplayCount();

            case DISPLAY_CMD_GETDISPLAYMODE:
                return  getDisplayMode();

            case DISPLAY_CMD_GETDISPPARA:
                return  getDisplayParameter(param0,param1);

            case DISPLAY_CMD_GETHDMISTATUS:
                return  getHdmiStatus();

            case DISPLAY_CMD_GETMASTERDISP:
                return  getMasterDisplay();

            case DISPLAY_CMD_GETMAXHDMIMODE:
                return  getMaxHdmiMode();

            case DISPLAY_CMD_GETMAXWIDTHDISP:
                return  getMaxWidthDisplay();

            case DISPLAY_CMD_GETTVSTATUS:
                return  getTvDacStatus();

            case DISPLAY_CMD_SETMASTERDISP:
                return  setMasterDisplay(param0);

            case DISPLAY_CMD_SETDISPMODE:
                return  setDisplayMode(param0);

            default:
                LOGE("Display Cmd not Support!\n");
                return  -1;
        }
    }
Пример #3
0
static void modeBasicClockFast(DisplayInternalInfo& displayInternalInfo) {
  MotionInfo motionInfo;

  // leave clock mode if there is no motion detected for a while 
  if (!displayInternalInfo.motionSensor.getMotionValue(&motionInfo) && 
      (motionInfo.lastChangedMin > 15 || motionInfo.lastChangedHour > 0)) {
    changeDisplayMode(displayModeNothing, displayInternalInfo);
    return;
  }

  modeBasicClockShowSeconds(displayInternalInfo);
  //modeBasicClockSDoUpDownAnimation(displayInternalInfo);
  updateMotionDetectedPixel(displayInternalInfo);
}
Пример #4
0
void DisplayInternal::doHandleMsgModePost(const StringMap& postValues) {
  initModeMessageData(0 /*currX*/, 5 /*currY*/, true /*incrementX*/, false /*incrementY*/,
		      0 /*confetti*/, false /*blink*/, font5x4 /*font*/, 60 /*timeout*/);

  for (auto& kvp : postValues) {
    const std::string& k = kvp.first;
    const std::string& v = kvp.second;
    const char* const key = k.c_str();
    const char* const value = v.c_str(); 

    if (strncasecmp(key, "msg", strlen(key)) == 0) {
      if (strncasecmp(value, "#cookie", 7) == 0) {
	if (value[7] == 0) {
	  modeMessageData.modeMsgsIndex = (ModeMsgsIndex) getRandomNumber(modeMsgsIndexLast);
	} else {
	  modeMessageData.modeMsgsIndex = (ModeMsgsIndex) strtoul(&value[7], NULL, 10);
	}
	// nitpick: skip 0
	if (modeMessageData.modeMsgsIndex == modeMsgsIndexBoot) modeMessageData.modeMsgsIndex = modeMsgsIndexFortunate1;
      } else {
	strncpy(modeMessageData.msg, value, sizeof(modeMessageData.msg));
      }
    } else if (strncasecmp(key, "x", strlen(key)) == 0) {
      modeMessageData.currX = strtoul(value, NULL, 10);
    } else if (strncasecmp(key, "y", strlen(key)) == 0) {
      modeMessageData.currYFactor = strtoul(value, NULL, 10) * INCREMENT_Y_SCALE;
    } else if (strncasecmp(key, "font", strlen(key)) == 0) {
      modeMessageData.font = (Font) strtoul(value, NULL, 10);
    } else if (strncasecmp(key, "alternateFont", strlen(key)) == 0) {
      modeMessageData.alternateFont = parseBooleanValue(value);
    } else if (strncasecmp(key, "confetti", strlen(key)) == 0) {
      modeMessageData.confetti = strtoul(value, NULL, 10);
    } else if (strncasecmp(key, "bounce", strlen(key)) == 0) {
      modeMessageData.incrementY = parseBooleanValue(value) ? INCREMENT_Y_VALUE : 0;
    } else if (strncasecmp(key, "noScroll", strlen(key)) == 0) {
      modeMessageData.incrementX = parseBooleanValue(value) ? false : true;
    } else if (strncasecmp(key, "blink", strlen(key)) == 0) {
      modeMessageData.blink = parseBooleanValue(value);
    } else if (strncasecmp(key, "color", strlen(key)) == 0) {
      modeMessageData.displayColor = (DisplayColor) strtoul(value, NULL, 10);
    } else if (strncasecmp(key, "repeats", strlen(key)) == 0) {
	modeMessageData.repeats = strtoul(value, NULL, 10);
    } else if (strncasecmp(key, "timeout", strlen(key)) == 0) {
      modeMessageData.timeout = strtoul(value, NULL, 10);
    }
  } // for
  changeDisplayMode(displayModeMessage, *info);
}
Пример #5
0
static void modeNothingCheckMotion(DisplayInternalInfo& displayInternalInfo) {
  static int row = 0; static int col = 0; static Int8U color = 0;

  if (displayInternalInfo.motionSensor.getMotionValue()) {
    changeDisplayMode(displayModeBasicClock, displayInternalInfo);
    return;
  }

  HT1632Class& HT1632 = displayInternalInfo.ht1632;
  HT1632.clearAll();
  for (int boardId=0; boardId < BUFFER_SECONDARY; ++boardId) {
    if (color != (Int8U) displayColorYellow && color != (Int8U) boardId) continue;

    HT1632.drawTarget(BUFFER_BOARD(boardId+1));
    HT1632.setPixel(row, col, true);
  }
  HT1632.renderAll();

  // Prepare statics for next iteration
  if (++color > (Int8U) displayColorYellow) {
    color = 0;
    if (++row >= OUT_SIZE) { if (++col >= COM_SIZE) col = 0; row = 0; }
  }
}
Пример #6
0
void parseBt(){
    char c = masterSerialCopy.getc();
    if (c == 'm'){
      changeDisplayMode();
    }
}
Пример #7
0
static void changeDisplayModeBasicClock(DisplayInternalInfo& displayInternalInfo, const void* param) {
  changeDisplayMode(displayModeBasicClock, displayInternalInfo, param);
}