public unsafe static void Hmi_ScanHexCode() { PosLaction posLaction = default(PosLaction); strxinxi strxinxi = default(strxinxi); Readdata.Readdata_ReadStr(ref strxinxi, (int)Hmi.myapp.Hexstrindex); myappinf expr_28 = Hmi.myapp; expr_28.Hexstrindex += 1; if (strxinxi.size == 0 || strxinxi.size > 2048) { Hmi.Hmi_CodeEnd(); } else { Readdata.SPI_Flash_Read(Hmi.Hexstrbuf, Hmi.myapp.app.strdataadd + strxinxi.addbeg, (uint)strxinxi.size); if (strxinxi.size == 1 && *Hmi.Hexstrbuf == 69) { Hmi.Hmi_CodeEnd(); } else { posLaction.star = 0; posLaction.end = (ushort)(strxinxi.size - 1); if (Hmi.myapp.upapp.runapptype == runapptype.run) { if (CodeRun.Coderun_Run(Hmi.Hexstrbuf, &posLaction) == 0 && Hmi.myapp.errcode < 255) { Commake.Commake_SendBackerr(Hmi.myapp.errcode); } } } } }
private unsafe static byte DrawSliderBackGround(objxinxi *obj, SLIDER_PARAM *pSliRam) { byte result; switch (pSliRam->BackType) { case 0: if (pSliRam->BkPicID >= GuiSlider.myapp.app.picqyt) { result = 0; return(result); } Readdata.Readdata_ReadPic(ref GuiSlider.myapp.brush.pic, (int)pSliRam->BkPicID); break; case 1: GuiSlider.myapp.brush.backcolor = pSliRam->BkPicID; break; case 2: if (pSliRam->BkPicID >= GuiSlider.myapp.app.picqyt) { result = 0; return(result); } GuiSlider.myapp.brush.x = obj->redian.x; GuiSlider.myapp.brush.y = obj->redian.y; Readdata.Readdata_ReadPic(ref GuiSlider.myapp.brush.pic, (int)pSliRam->BkPicID); break; } GuiSlider.myapp.brush.sta = pSliRam->BackType; Showpic.Showpic_Clearspa((int)obj->redian.x, (int)obj->redian.y, (int)(obj->redian.endx - obj->redian.x + 1), (int)(obj->redian.endy - obj->redian.y + 1)); result = 1; return(result); }
public unsafe static void SPI_Flash_Read(ref byte[] buf, uint add, uint qyt) { fixed(byte *ptr = buf) { Readdata.SPI_Flash_Read(ptr, add, qyt); } }
public unsafe static byte Hmi_Refobj(byte index) { objxinxi objxinxi = default(objxinxi); byte b = 0; byte result; if (index < Hmi.myapp.dpagexinxi.objqyt) { if (Hmi.myapp.pageobjs[index].vis == 1) { ushort index2 = (ushort)(Hmi.myapp.dpagexinxi.objstar + (ushort)index); Readdata.Readdata_ReadObj(ref objxinxi, (int)index2); if (objxinxi.objType < 50) { GuiObjControl.GuiObjControls[(int)objxinxi.objType].Ref(&objxinxi, index); } else if (objxinxi.redian.events.Ref != 0) { Hmi.Hmi_SetHexIndex((int)(objxinxi.redian.events.Ref + objxinxi.zhilingstar)); if (Hmi.myapp.Hexstrindex != 65535) { b = 1; } } } Hmi.myapp.pageobjs[index].refFlag = 0; result = b; } else { Hmi.myapp.errcode = 2; result = 0; } return(result); }
public unsafe static void Touch_Tpscan() { if (Touch.myapp.upapp.tp_dev.touchstate == 1) { Touch.myapp.upapp.tp_dev.x_now = (ushort)(Control.MousePosition.X - Touch.myapp.upapp.mouse_pos.X + (int)Touch.myapp.upapp.tp_dev.x_down); Touch.myapp.upapp.tp_dev.y_now = (ushort)(Control.MousePosition.Y - Touch.myapp.upapp.mouse_pos.Y + (int)Touch.myapp.upapp.tp_dev.y_down); if (Touch.myapp.dra == 1) { Lcd.Lcd_Fill((int)Touch.myapp.upapp.tp_dev.x_now, (int)Touch.myapp.upapp.tp_dev.y_now, 2, 2, Touch.myapp.dracolor); } if (Touch.myapp.Hexstrindex == 65535 && Touch.myapp.moveobjstate > 0 && Touch.myapp.systime.movetime > 20u) { objxinxi objxinxi = default(objxinxi); Readdata.Readdata_ReadObj(ref objxinxi, (int)((ushort)Touch.myapp.downobjid + Touch.myapp.dpagexinxi.objstar)); if (GuiSlider.GuiSliderPressMove(&objxinxi, Touch.myapp.downobjid) > 0) { if (objxinxi.redian.events.Slide != 0 && Touch.myapp.Hexstrindex == 65535) { Touch.myapp.Hexstrindex = (ushort)(objxinxi.redian.events.Slide + objxinxi.zhilingstar); } } Touch.myapp.systime.movetime = 0u; } } }
public unsafe static byte Hmi_GuiObjectInit(byte ObjId) { objxinxi objxinxi = default(objxinxi); Readdata.Readdata_ReadObj(ref objxinxi, (int)(Hmi.myapp.dpagexinxi.objstar + (ushort)ObjId)); if (objxinxi.objType < 50) { GuiObjControl.GuiObjControls[(int)objxinxi.objType].Init(&objxinxi, ObjId); } return(1); }
public unsafe static byte Hmi_Hideobj(byte index) { objxinxi objxinxi = default(objxinxi); if (Hmi.myapp.pageobjs[index].vis == 1 && Hmi.myapp.pagestate == 1) { Readdata.Readdata_ReadObj(ref objxinxi, (int)(Hmi.myapp.dpagexinxi.objstar + (ushort)index)); if (objxinxi.redian.events.Vis != 0) { Hmi.Hmi_SetHexIndex((int)(objxinxi.redian.events.Vis + objxinxi.zhilingstar)); } } Hmi.myapp.pageobjs[index].vis = 0; return(1); }
public unsafe static byte Hmi_RefPage(ushort index) { strxinxi strxinxi = default(strxinxi); byte result; if (index >= Hmi.myapp.app.pageqyt) { Hmi.myapp.errcode = 3; result = 0; } else { Hmi.myapp.dpage = index; Hmi.myapp.downobjid = 255; Hmi.myapp.moveobjstate = 0; Hmi.myapp.dpagemerrypos = 0; Hmi.Hmi_ClearTimer(); Hmi.Hmi_Clearredian(0); Hmi.Hmi_ClearHexstr(); Hmi.Hmi_GuiPageInit(); if (Hmi.myapp.upapp.runapptype != runapptype.run || Hmi.myapp.binsuc != 1) { result = 1; } else { Hmi.myapp.upapp.pageidchange((int)index); Readdata.Readdata_ReadPage(ref Hmi.myapp.dpagexinxi, (int)index); Readdata.Readdata_ReadStr(ref strxinxi, (int)Hmi.myapp.dpagexinxi.zhilingstar); Hmi.myapp.dobjnameseradd = strxinxi.addbeg + Hmi.myapp.app.strdataadd; Hmi.myapp.pageobjs = (pageobjs_ *)(Hmi.myapp.mymerry + Hmi.myapp.ovemerrys); if (Hmi.myapp.dpagexinxi.zhilingqyt > 0) { Readdata.Readdata_ReadStr(ref strxinxi, (int)(Hmi.myapp.dpagexinxi.zhilingstar + 1)); Readdata.SPI_Flash_Read(Hmi.myapp.mymerry + Hmi.myapp.ovemerrys, Hmi.myapp.app.strdataadd + strxinxi.addbeg, (uint)strxinxi.size); Hmi.myapp.dpagemerrypos = (ushort)(Hmi.myapp.ovemerrys + strxinxi.size); Hmi.myapp.Hexstrindex = (ushort)(Hmi.myapp.dpagexinxi.zhilingstar + 2); Hmi.myapp.pagestate = 0; } result = 1; } } return(result); }
//public unsafe static uint Datafind_FindU32_Flash(uint* val, uint datastar, ushort datarows, ushort datalenth) //{ // int i = 0; // int num = (int)(datarows - 1); // uint[] array = new uint[2]; // uint result; // while (i < num) // { // uint num2 = (uint)(i + (num - i >> 1)); // fixed (void* ptr = array) // { // Readdata.SPI_Flash_Read((byte*)ptr, datastar + num2 * (uint)datalenth, 8u); // } // if (array[0] > *val) // { // num = (int)(num2 - 1u); // } // else // { // if (array[0] >= *val) // { // result = array[1]; // return result; // } // i = (int)(num2 + 1u); // } // } // fixed (void* ptr2 = (void*)(&array[0])) // { // Readdata.SPI_Flash_Read((byte*)ptr2, (uint)((ulong)datastar + (ulong)((long)(i * (int)datalenth))), 8u); // } // if (array[0] == *val) // { // result = array[1]; // return result; // } // result = 4294967295u; // return result; //} public static unsafe uint Datafind_FindU32_Flash(uint *val, uint datastar, ushort datarows, ushort datalenth) { int i = 0; int num = (int)(datarows - 1); uint[] array = new uint[2]; uint result; while (i < num) { uint num2 = (uint)(i + (num - i >> 1)); fixed(void *ptr = array) { Readdata.SPI_Flash_Read((byte *)ptr, datastar + num2 * (uint)datalenth, 8u); } if (array[0] > *val) { num = (int)(num2 - 1u); } else { if (array[0] >= *val) { result = array[1]; return(result); } i = (int)(num2 + 1u); } } fixed(void *ptr2 = array) { Readdata.SPI_Flash_Read((byte *)ptr2, (uint)((ulong)datastar + (ulong)((long)(i * (int)datalenth))), 8u); } if (array[0] == *val) { result = array[1]; return(result); } result = 4294967295u; return(result); }
private unsafe static byte DrawSliderCursor(objxinxi *obj, SLIDER_PARAM *pSliRam, ushort *CurXPos, ushort *CurXEnd, ushort *CurYPos, ushort *CurYEnd) { if (pSliRam->Mode > 0) { byte b = (byte)(pSliRam->CursorHig / 2); * CurXPos = (ushort)((obj->redian.endx - obj->redian.x + 1 - (ushort)pSliRam->CursorWid) / 2 + obj->redian.x); * CurXEnd = (ushort)(*CurXPos + (ushort)pSliRam->CursorWid - 1); * CurYEnd = (ushort)(pSliRam->TouchPos + (ushort)b); * CurYPos = (ushort)(*CurYEnd - (ushort)pSliRam->CursorHig + 1); } else { byte b = (Convert.ToByte(pSliRam->CursorWid / 2)); * CurYPos = (ushort)((obj->redian.endy - obj->redian.y + 1 - (ushort)pSliRam->CursorHig) / 2 + obj->redian.y); * CurYEnd = (ushort)(*CurYPos + (ushort)pSliRam->CursorHig - 1); * CurXPos = (ushort)(pSliRam->TouchPos - (ushort)b); * CurXEnd = (ushort)(*CurXPos + (ushort)pSliRam->CursorWid - 1); } byte result; if (pSliRam->CursorType > 0) { if (pSliRam->CuPicID >= GuiSlider.myapp.app.picqyt) { result = 0; return(result); } GuiSlider.myapp.brush.sta = 2; Readdata.Readdata_ReadPic(ref GuiSlider.myapp.brush.pic, (int)pSliRam->CuPicID); GuiSlider.myapp.brush.x = *CurXPos; GuiSlider.myapp.brush.y = *CurYPos; } else { GuiSlider.myapp.brush.sta = 1; GuiSlider.myapp.brush.backcolor = pSliRam->CuPicID; } Showpic.Showpic_Clearspa((int)(*CurXPos), (int)(*CurYPos), (int)pSliRam->CursorWid, (int)pSliRam->CursorHig); result = 1; return(result); }
public unsafe static byte Hmi_loadref(byte index) { objxinxi objxinxi = default(objxinxi); byte result; if (index < Hmi.myapp.dpagexinxi.objqyt) { ushort index2 = (ushort)(Hmi.myapp.dpagexinxi.objstar + (ushort)index); Readdata.Readdata_ReadObj(ref objxinxi, (int)index2); if (objxinxi.objType < 50) { GuiObjControl.GuiObjControls[(int)objxinxi.objType].Load(&objxinxi, index); } result = 1; } else { Hmi.myapp.errcode = 2; result = 0; } return(result); }
private unsafe static uint Findziadd(byte h, byte l, zimoxinxi *mzimo) { byte[] array = new byte[2]; ushort num = (ushort)((int)h * 256 + (int)l); uint num2 = 0u; uint num3 = (uint)((ushort)(mzimo->qyt - 1u)); uint num4 = mzimo->addbeg + Showfont.myapp.app.zimodataadd + (uint)mzimo->ascstar; uint result; while (num3 >= num2) { uint num5 = (num3 + num2) / 2u; uint add = num4 + num5 * 2u; Readdata.SPI_Flash_Read(ref array, add, 2u); if (array[0] == h && array[1] == l) { result = mzimo->addbeg + Showfont.myapp.app.zimodataadd + (uint)mzimo->datastar + num5 * (uint)mzimo->w * (uint)mzimo->h / 8u; } else { if (num3 != num2) { if ((ushort)array[0] * 256 + (ushort)array[1] > num) { num3 = num5 - 1u; } else { num2 = num5 + 1u; } continue; } result = 0u; } return(result); } result = mzimo->addbeg + Showfont.myapp.app.zimodataadd + (uint)mzimo->datastar; return(result); }
public unsafe static byte Showpic_ShowXpic(int x, int y, ushort w, ushort h, int x2, int y2, ushort picindex) { Picturexinxi picturexinxi = default(Picturexinxi); byte result; if (picindex >= Showpic.myapp.app.picqyt) { if (picindex == 65535) { result = 1; } else { Showpic.myapp.errcode = 4; result = 0; } } else { Readdata.Readdata_ReadPic(ref picturexinxi, (int)picindex); result = Showpic.Showpic_ShowXpic_M(x, y, w, h, x2, y2, &picturexinxi); } return(result); }
public unsafe static byte GuiCurveRef(objxinxi *obj, byte ID) { byte qyt = 0; byte[] buffer = new byte[4]; ushort[] numArray = new ushort[4]; ushort[] numArray2 = new ushort[4]; ushort[] numArray3 = new ushort[4]; ushort[] numArray4 = new ushort[4]; byte[] buffer2 = new byte[4]; int num9 = 0; int num10 = 0; Picturexinxi pic = new Picturexinxi(); CURVE_PARAM *curve_paramPtr = (CURVE_PARAM *)(myapp.mymerry + obj->attpos); CURVE_CHANNEL_PARAM *[] curve_channel_paramPtrArray = new CURVE_CHANNEL_PARAM *[4]; short x = 0; short num12 = 0; short endy = 0; short y = 0; short num17 = 0; if (curve_paramPtr->CH_qyt <= 4) { byte num3; for (num3 = 0; num3 < curve_paramPtr->CH_qyt; num3 = (byte)(num3 + 1)) { curve_channel_paramPtrArray[num3] = (CURVE_CHANNEL_PARAM *)((((uint)curve_paramPtr) + sizeof(CURVE_PARAM)) + (sizeof(CURVE_CHANNEL_PARAM) * num3)); } byte num2 = 0; num3 = 0; while (num3 < curve_paramPtr->CH_qyt) { buffer[num3] = 1; numArray3[num3] = curve_channel_paramPtrArray[num3]->DotLen; if (numArray3[num3] > 0) { num2 = (byte)(num2 + 1); } numArray4[num3] = obj->redian.x; if (curve_paramPtr->DrawDir == 0) { numArray[num3] = (ushort)(curve_channel_paramPtrArray[num3]->BufNext - 1); num17 = -1; } else { num17 = (short)(curve_channel_paramPtrArray[num3]->BufNext - curve_channel_paramPtrArray[num3]->BufPos.star); if (num17 >= numArray3[num3]) { numArray[num3] = (ushort)(curve_channel_paramPtrArray[num3]->BufNext - curve_channel_paramPtrArray[num3]->DotLen); } else { numArray[num3] = (ushort)((curve_channel_paramPtrArray[num3]->BufPos.end - (curve_channel_paramPtrArray[num3]->DotLen - num17)) + 1); } if (curve_paramPtr->DrawDir == 2) { num17 = (short)((obj->redian.endx - obj->redian.x) + 1); if (numArray3[num3] < num17) { numArray4[num3] = (ushort)(numArray4[num3] + ((ushort)(num17 - numArray3[num3]))); } } num17 = 1; } num3 = (byte)(num3 + 1); } if (num2 == 0) { CurveRefBack(obj, ID); } else { if (curve_paramPtr->BackType == 0) { qyt = 5; Readdata.Readdata_ReadPic(ref pic, curve_paramPtr->PicID); num9 = (int)(pic.addbeg + myapp.app.picdataadd); if (myapp.upapp.lcddev.guidire == 0) { num9 += ((obj->redian.y * pic.W) + obj->redian.x) << 1; num10 = qyt << 1; } else if (myapp.upapp.lcddev.guidire == 1) { num9 += (((pic.H - obj->redian.endy) - 1) + (obj->redian.x * pic.H)) << 1; num10 = (qyt * pic.H) << 1; } else if (myapp.upapp.lcddev.guidire == 2) { num9 += ((((pic.H - obj->redian.endy) * pic.W) - obj->redian.x) - qyt) << 1; num10 = qyt * -2; } else if (myapp.upapp.lcddev.guidire == 3) { num9 += (obj->redian.y + (((pic.W - obj->redian.x) - qyt) * pic.H)) << 1; num10 = (qyt * pic.H) * -2; } } else if (curve_paramPtr->BackType == 2) { qyt = 5; Readdata.Readdata_ReadPic(ref pic, curve_paramPtr->PicID); num9 = (int)(pic.addbeg + myapp.app.picdataadd); if (myapp.upapp.lcddev.guidire == 0) { num10 = qyt << 1; } else if (myapp.upapp.lcddev.guidire == 1) { num10 = (qyt * pic.H) << 1; } else if (myapp.upapp.lcddev.guidire == 2) { num9 += (pic.W - qyt) << 1; num10 = qyt * -2; } else if (myapp.upapp.lcddev.guidire == 3) { num9 += ((pic.W - qyt) * pic.H) << 1; num10 = (qyt * pic.H) * -2; } } else { x = (short)obj->redian.x; num12 = (short)(x + curve_paramPtr->GridX); } for (short i = (short)obj->redian.x; i <= obj->redian.endx; i = (short)(i + qyt)) { short endx = (short)((i + 5) - 1); if (endx > obj->redian.endx) { endx = (short)obj->redian.endx; } if (curve_paramPtr->BackType == 1) { if (curve_paramPtr->GridX > 0) { ushort num15; ushort num16; if (i == x) { Lcd.LCD_addset((ushort)i, obj->redian.y, (ushort)i, obj->redian.endy, 1); Lcd.Lcd_WR_POINT(curve_paramPtr->objHig, curve_paramPtr->Griclr); num15 = (ushort)(i + 1); } else { num15 = (ushort)i; } if ((num15 + 5) >= num12) { num16 = (ushort)(num12 - 1); x = num12; num12 = (short)(num12 + curve_paramPtr->GridX); } else { num16 = (ushort)((num15 + 5) - 1); } qyt = (byte)((num16 - i) + 1); if ((i + qyt) > obj->redian.endx) { num16 = (ushort)endx; qyt = (byte)((endx - i) + 1); } if (curve_paramPtr->GridY > 0) { endy = (short)obj->redian.endy; while (endy >= obj->redian.y) { y = (short)((endy - curve_paramPtr->GridY) + 1); if (y < obj->redian.y) { y = (short)obj->redian.y; } Lcd.LCD_addset(num15, (ushort)endy, num16, (ushort)endy, 1); Lcd.Lcd_WR_POINT((ushort)((num16 - num15) + 1), curve_paramPtr->Griclr); Lcd.LCD_addset(num15, (ushort)y, num16, (ushort)(endy - 1), 1); Lcd.Lcd_WR_POINT((uint)(((num16 - num15) + 1) * (endy - y)), curve_paramPtr->Bkclr); endy = (short)(endy - curve_paramPtr->GridY); } } else { num9 = curve_paramPtr->objHig * ((num16 - num15) + 1); Lcd.LCD_addset(num15, obj->redian.y, num16, obj->redian.endy, 1); Lcd.Lcd_WR_POINT((uint)num9, curve_paramPtr->Bkclr); } } else if (curve_paramPtr->GridY > 0) { for (endy = (short)obj->redian.endy; endy >= obj->redian.y; endy = (short)(endy - curve_paramPtr->GridY)) { y = (short)((endy - curve_paramPtr->GridY) + 1); if (y < obj->redian.y) { y = (short)obj->redian.y; } Lcd.LCD_addset((ushort)i, (ushort)y, (ushort)endx, (ushort)endy, 1); qyt = (byte)((endx - i) + 1); Lcd.Lcd_WR_POINT((uint)(qyt * (endy - y)), curve_paramPtr->Bkclr); Lcd.Lcd_WR_POINT(qyt, curve_paramPtr->Griclr); } } else { qyt = (byte)((endx - i) + 1); num9 = curve_paramPtr->objHig * ((endx - i) + 1); Lcd.LCD_addset((ushort)i, obj->redian.y, (ushort)endx, obj->redian.endy, 1); Lcd.Lcd_WR_POINT((uint)num9, curve_paramPtr->Bkclr); } } else { Lcd.LCD_addset((ushort)i, obj->redian.y, (ushort)endx, obj->redian.endy, 1); if ((myapp.upapp.lcddev.guidire & 1) > 0) { Showpic.Showpic_SendDataOffset((uint)num9, (ushort)(pic.H << 1), (ushort)((endx - i) + 1), (byte)curve_paramPtr->objHig); } else { Showpic.Showpic_SendDataOffset((uint)num9, (ushort)(pic.W << 1), curve_paramPtr->objHig, (byte)((endx - i) + 1)); } num9 += num10; } for (num3 = 0; num3 < curve_paramPtr->CH_qyt; num3 = (byte)(num3 + 1)) { if ((numArray3[num3] > 0) && (i >= numArray4[num3])) { for (num2 = 0; num2 < qyt; num2 = (byte)(num2 + 1)) { byte num6; byte num5 = myapp.mymerry[numArray[num3]]; byte num4 = buffer2[num3]; if (buffer[num3] > 0) { num4 = num5; buffer[num3] = 0; } if (num5 > num4) { num6 = (byte)((num5 - num4) + 1); Lcd.LCD_addset((ushort)(i + num2), (ushort)(obj->redian.endy - num5), (ushort)(i + num2), (ushort)(obj->redian.endy - num4), 1); Lcd.Lcd_WR_POINT(num6, curve_channel_paramPtrArray[num3]->Penclr); } else { num6 = (byte)((num4 - num5) + 1); Lcd.LCD_addset((ushort)(i + num2), (ushort)(obj->redian.endy - num4), (ushort)(i + num2), (ushort)(obj->redian.endy - num5), 1); Lcd.Lcd_WR_POINT(num6, curve_channel_paramPtrArray[num3]->Penclr); } buffer2[num3] = num5; numArray[num3] = (ushort)(numArray[num3] + num17); if (numArray[num3] > curve_channel_paramPtrArray[num3]->BufPos.end) { numArray[num3] = curve_channel_paramPtrArray[num3]->BufPos.star; } else if (numArray[num3] < curve_channel_paramPtrArray[num3]->BufPos.star) { numArray[num3] = curve_channel_paramPtrArray[num3]->BufPos.end; } numArray3[num3] = (ushort)(numArray3[num3] - 1); if (numArray3[num3] == 0) { break; } } } } } } myapp.pageobjs[ID].refFlag = 0; } return(0); }
public static unsafe void Hmi_Init() { strxinxi strxinxi = default(strxinxi); appinf0 appinf = default(appinf0); Hmi.myapp.delay = 0; Hmi.myapp.brush.sta = 0; Hmi.myapp.brush.pointcolor = 0; Hmi.myapp.brush.backcolor = 0; Hmi.myapp.brush.hangjux = 0; Hmi.myapp.brush.hangjuy = 0; Hmi.myapp.brush.xjuzhong = 0; Hmi.myapp.brush.yjuzhong = 0; Hmi.myapp.upapp.lcddev.wup = 255; Hmi.myapp.brush.pw = 0; Hmi.myapp.paus = 0; Hmi.myapp.sys.thsp = 0; Hmi.myapp.sys.thsleepup = 0; Hmi.myapp.sys.ussp = 0; Hmi.myapp.touchsendxy = 0; Hmi.myapp.errcode = 255; Hmi.myapp.dpage = 0; Hmi.myapp.Hexstrindex = 65535; Hmi.myapp.downobjid = 255; Hmi.myapp.moveobjstate = 0; Hmi.Hmi_ClearTimer(); Hmi.Hmi_Clearredian(0); Hmi.Hmi_ClearHexstr(); Hmi.myapp.dpagemerrypos = 0; if (Hmi.myapp.binsuc != 1) { MessageOpen.Show("Data Error!"); } else { Touch.TP_REST(); Readdata.Readdata_ReadApp0(ref appinf); if (Hmi.myapp.app.strqyt > 0u) { Readdata.Readdata_ReadStr(ref strxinxi, 0); if (strxinxi.size < 8192) { Readdata.SPI_Flash_Read(Hmi.myapp.mymerry, Hmi.myapp.app.strdataadd + strxinxi.addbeg, (uint)strxinxi.size); Hmi.myapp.ovemerrys = strxinxi.size; } } Readdata.Readdata_ReadStr(ref strxinxi, 1); Hmi.myapp.pagenameseradd = strxinxi.addbeg + Hmi.myapp.app.strdataadd; Hmi.myapp.upapp.Lcd_Set(appinf.guidire); uint[] array = new uint[2]; Hmi.lastpagenamecrc = array; Hmi.lastpageid = new ushort[] { 65535, 65535 }; Hmi.lastobjaddr = new uint[] { 65535u, 65535u }; array = new uint[2]; Hmi.lastobjnamecrc = array; Hmi.lastobjid = new ushort[] { 65535, 65535 }; } }
public unsafe static void Hmi_Getredian(byte state) { objxinxi objxinxi = default(objxinxi); byte b = (byte)(Hmi.myapp.dpagexinxi.objqyt - 1); int num = (int)(Hmi.myapp.dpagexinxi.objstar + (ushort)Hmi.myapp.dpagexinxi.objqyt - 1); if (Hmi.myapp.dpagexinxi.objqyt != 0) { if (Hmi.myapp.touchsendxy == 1) { Usart.Usart_SendByte(103); Usart.Usart_SendByte((byte)(Hmi.myapp.upapp.tp_dev.x_down >> 8)); Usart.Usart_SendByte((byte)Hmi.myapp.upapp.tp_dev.x_down); Usart.Usart_SendByte((byte)(Hmi.myapp.upapp.tp_dev.y_down >> 8)); Usart.Usart_SendByte((byte)Hmi.myapp.upapp.tp_dev.y_down); Usart.Usart_SendByte(state); Commake.Commake_SendEnd(); } if (state == 1) { for (int i = num; i >= (int)Hmi.myapp.dpagexinxi.objstar; i--) { if (Hmi.myapp.pageobjs[b].vis == 1) { Readdata.Readdata_ReadObj(ref objxinxi, i); if (Hmi.myapp.upapp.tp_dev.x_down > objxinxi.redian.x && Hmi.myapp.upapp.tp_dev.x_down < objxinxi.redian.endx && Hmi.myapp.upapp.tp_dev.y_down > objxinxi.redian.y && Hmi.myapp.upapp.tp_dev.y_down < objxinxi.redian.endy) { if (Hmi.myapp.pageobjs[b].touchstate != 1) { return; } if (Hmi.myapp.downobjid != b) { Hmi.myapp.downobjid = b; if (objxinxi.objType == objtype.OBJECT_TYPE_SLIDER) { GuiSlider.GuiSliderPressDown(&objxinxi, b); Hmi.myapp.moveobjstate = 1; } if (objxinxi.redian.events.Down != 0) { Hmi.Hmi_SetHexIndex((int)(objxinxi.redian.events.Down + objxinxi.zhilingstar)); } } break; } } b -= 1; } } else if (state == 0) { if (Hmi.myapp.downobjid == 255 || Hmi.myapp.pageobjs[Hmi.myapp.downobjid].vis == 0) { return; } b = Hmi.myapp.downobjid; int i = (int)((ushort)Hmi.myapp.downobjid + Hmi.myapp.dpagexinxi.objstar); Readdata.Readdata_ReadObj(ref objxinxi, i); if (objxinxi.objType == objtype.OBJECT_TYPE_SLIDER) { GuiSlider.GuiSliderPressUp(&objxinxi, Hmi.myapp.downobjid); } if (objxinxi.redian.events.Up != 0) { Hmi.Hmi_SetHexIndex((int)(objxinxi.redian.events.Up + objxinxi.zhilingstar)); } if (objxinxi.redian.events.Slide != 0) { Hmi.Hmi_SetHexIndex((int)(objxinxi.redian.events.Slide + objxinxi.zhilingstar)); } } if (((int)objxinxi.redian.sendkey & 1 << (int)state) > 0) { Usart.Usart_SendByte(101); Usart.Usart_SendByte((byte)Hmi.myapp.dpage); Usart.Usart_SendByte(b); Usart.Usart_SendByte(state); Commake.Commake_SendEnd(); } } }
public static byte Readdata_ReadBinapp() { byte[] array = new byte[4]; appinf0 appinf = default(appinf0); byte result; if (Readdata.Readdata_ReadApp0(ref appinf) == 0) { result = 0; } else { byte[] array2 = new byte[Marshal.SizeOf(default(appinf1))]; Readdata.myapp.upapp.filesr.BaseStream.Position = 200L; Readdata.myapp.upapp.filesr.BaseStream.Read(array2, 0, Marshal.SizeOf(default(appinf1))); Readdata.myapp.upapp.filesr.BaseStream.Position = 396L; Readdata.myapp.upapp.filesr.BaseStream.Read(array, 0, 4); if ((uint)array.BytesTostruct(0u.GetType()) != array2.getcrc(4294967295u, 0, (int)Readdata.appxinxisize1)) { result = 0; } else { array2 = array2.Appfree10(datasize.apppasseord, appinf.Modelcrc); Readdata.myapp.app = (appinf1)array2.BytesTostruct(default(appinf1).GetType()); progform progform = null; int num = 1; int num2 = 0; if (Readdata.myapp.upapp.runapptype == runapptype.run && Readdata.myapp.upapp.images == null) { Readdata.myapp.upapp.images = new List <guiimagetype>(); if (Readdata.myapp.app.picqyt > 0) { num = (int)(Readdata.myapp.app.zimodataadd - Readdata.myapp.app.picdataadd); num2 = 0; progform = new progform(); progform.Show(); Application.DoEvents(); Thread.Sleep(300); } for (int i = 0; i < (int)Readdata.myapp.app.picqyt; i++) { Picturexinxi pic = default(Picturexinxi); Readdata.Readdata_ReadPic(ref pic, i); guiimagetype item = default(guiimagetype); item.imagebitbmp = new Bitmap((int)pic.W, (int)pic.H); byte[] array3 = new byte[(int)(pic.W * pic.H * 2)]; Readdata.myapp.upapp.filesr.BaseStream.Position = (long)(pic.addbeg + Readdata.myapp.app.picdataadd); Readdata.myapp.upapp.filesr.BaseStream.Read(array3, 0, array3.Length); item.imagebitbmp = array3.GetBitmap(pic, datasize.Opentouming); Readdata.myapp.upapp.images.Add(item); num2 += (int)pic.imgbytesize; progform.setprogval(num2 * 100 / num); Application.DoEvents(); } if (progform != null) { Application.DoEvents(); Thread.Sleep(300); progform.Close(); } } result = 1; } } return(result); }
private unsafe static byte ClearSliderCursor(objxinxi *obj, SLIDER_PARAM *pSliRam, ushort *CurXPos, ushort *CurXEnd, ushort *CurYPos, ushort *CurYEnd) { ushort num = 0; ushort num2 = 0; ushort num3 = 0; ushort num4 = 0; if (pSliRam->Mode > 0) { num = *CurXPos; num3 = *CurXEnd; if (*CurYEnd < pSliRam->LastPos) { num4 = pSliRam->LastPos; num2 = (ushort)(num4 - (ushort)pSliRam->CursorHig + 1); if (*CurYEnd >= num2) { num2 = (ushort)(*CurYEnd + 1); } } else if (*CurYEnd > pSliRam->LastPos) { num4 = pSliRam->LastPos; num2 = (ushort)(num4 - (ushort)pSliRam->CursorHig + 1); if (num4 >= *CurYPos) { num4 = (ushort)(*CurYPos - 1); } } } else { num2 = *CurYPos; num4 = *CurYEnd; if (*CurXPos < pSliRam->LastPos) { num = pSliRam->LastPos; num3 = (ushort)(num + (ushort)pSliRam->CursorWid - 1); if (*CurXEnd >= num) { num = (ushort)(*CurXEnd + 1); } } else if (*CurXPos > pSliRam->LastPos) { num = pSliRam->LastPos; num3 = (ushort)(num + (ushort)pSliRam->CursorWid - 1); if (num3 >= *CurXPos) { num3 = (ushort)(*CurXPos - 1); } } } switch (pSliRam->BackType) { case 0: Readdata.Readdata_ReadPic(ref GuiSlider.myapp.brush.pic, (int)pSliRam->BkPicID); break; case 1: GuiSlider.myapp.brush.backcolor = pSliRam->BkPicID; break; case 2: Readdata.Readdata_ReadPic(ref GuiSlider.myapp.brush.pic, (int)pSliRam->BkPicID); GuiSlider.myapp.brush.x = obj->redian.x; GuiSlider.myapp.brush.y = obj->redian.y; break; } GuiSlider.myapp.brush.sta = pSliRam->BackType; Showpic.Showpic_Clearspa((int)num, (int)num2, (int)(num3 - num + 1), (int)(num4 - num2 + 1)); return(1); }
private static void SendZiku(int x, int y, byte h, byte l) { byte[] array = new byte[2]; int num = x; int num2 = y; byte b = 0; if (Showfont.myapp.brush.pw != 0) { h = 0; l = Showfont.myapp.brush.pw; } uint num3 = Showfont.myapp.brush.mzimo.addbeg + Showfont.myapp.app.zimodataadd + (uint)Showfont.myapp.brush.mzimo.datastar; if (Showfont.myapp.brush.mzimo.state == 1) { if (h != 0) { if (l > Showfont.myapp.brush.mzimo.codelT0) { l -= Showfont.myapp.brush.mzimo.codelV0; } b = Showfont.myapp.brush.mzimo.w; num3 += (uint)(((h - Showfont.myapp.brush.mzimo.codeh_star) * (Showfont.myapp.brush.mzimo.codel_end - Showfont.myapp.brush.mzimo.codel_star - Showfont.myapp.brush.mzimo.codelV0 + 1) + (l - Showfont.myapp.brush.mzimo.codel_star)) * (Showfont.myapp.brush.mzimo.w / 8) * Showfont.myapp.brush.mzimo.h); } else { b = Convert.ToByte(Showfont.myapp.brush.mzimo.w / 2); num3 += (uint)((ulong)(Showfont.myapp.brush.mzimo.qyt - 95u + (uint)l - 32u) * (ulong)((long)(Showfont.myapp.brush.mzimo.w / 8)) * (ulong)Showfont.myapp.brush.mzimo.h); } } else if (Showfont.myapp.brush.mzimo.state == 0) { b = Showfont.myapp.brush.mzimo.w; num3 += (uint)((l - 32) * (Showfont.myapp.brush.mzimo.h / 8 * Showfont.myapp.brush.mzimo.w)); } else if (Showfont.myapp.brush.mzimo.state == 2) { if (h > 0) { b = Showfont.myapp.brush.mzimo.w; } else { b = Convert.ToByte(Showfont.myapp.brush.mzimo.w / 2); } num3 = Showfont.Findziadd(h, l, ref Showfont.myapp.brush.mzimo); } ushort num4 = (ushort)(Showfont.myapp.brush.mzimo.h / 8 * b); switch (Showfont.myapp.upapp.lcddev.guidire) { case 1: y = (int)((ushort)(num2 + (int)Showfont.myapp.brush.mzimo.h - 1)); break; case 2: x = (int)((ushort)(num + (int)b - 1)); y = (int)((ushort)(num2 + (int)Showfont.myapp.brush.mzimo.h - 1)); break; case 3: x = (int)((ushort)(num + (int)b - 1)); break; } for (uint num5 = 0u; num5 < (uint)num4; num5 += 1u) { Readdata.SPI_Flash_Read(ref array, num3 + num5, 1u); for (byte b2 = 0; b2 < 8; b2 += 1) { if (((int)array[0] & 1 << (int)(7 - b2)) > 0) { if (x >= (int)Showfont.myapp.brush.x && x <= (int)Showfont.myapp.brush.endx && y >= (int)Showfont.myapp.brush.y && y <= (int)Showfont.myapp.brush.endy) { Lcd.Lcd_DrawPoint(x, y, Showfont.myapp.brush.pointcolor); } } switch (Showfont.myapp.upapp.lcddev.guidire) { case 0: x++; if (x - num == (int)b) { x = num; y++; } break; case 1: y--; if (y < num2) { y = (int)((ushort)(num2 + (int)Showfont.myapp.brush.mzimo.h - 1)); x++; } break; case 2: x--; if (x < num) { x = (int)((ushort)(num + (int)b - 1)); y--; } break; case 3: y++; if (y >= num2 + (int)Showfont.myapp.brush.mzimo.h) { y = num2; x--; } break; } } } }