コード例 #1
0
ファイル: Hmi.cs プロジェクト: skyclub66/HMI
        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);
                        }
                    }
                }
            }
        }
コード例 #2
0
 public unsafe static void timerm_5ms(uint tt)
 {
     try
     {
         myappinf expr_0C_cp_0 = GuiTimer.myapp;
         expr_0C_cp_0.systime.systemruntime = expr_0C_cp_0.systime.systemruntime + tt;
         myappinf expr_23_cp_0 = GuiTimer.myapp;
         expr_23_cp_0.systime.movetime = expr_23_cp_0.systime.movetime + tt;
         myappinf expr_3A_cp_0 = GuiTimer.myapp;
         expr_3A_cp_0.systime.guitime_20 = expr_3A_cp_0.systime.guitime_20 + tt;
         if (GuiTimer.myapp.systime.guitime_20 >= 20u)
         {
             try
             {
                 if (*GuiTimer.myapp.systimerbuf > 0)
                 {
                     for (int i = 0; i < (int)(*GuiTimer.myapp.systimerbuf); i++)
                     {
                         systimer_type *ptr = (systimer_type *)(GuiTimer.myapp.systimerbuf + (i * 5 + 4));
                         if (ptr->val < 65534 && ptr->val > 0)
                         {
                             systimer_type *expr_B2 = ptr;
                             expr_B2->val = (ushort)(expr_B2->val + 1);
                         }
                     }
                 }
             }
             catch
             {
                 MessageOpen.Show("merry conflict!");
             }
             GuiTimer.myapp.systime.guitime_20 = 0u;
         }
         if (GuiTimer.myapp.systime.touchdowntime > 0u)
         {
             myappinf expr_121_cp_0 = GuiTimer.myapp;
             expr_121_cp_0.systime.touchdowntime = expr_121_cp_0.systime.touchdowntime + tt;
         }
     }
     catch (Exception ex)
     {
         MessageOpen.Show("timerm_5ms Runerror:" + ex.Message);
     }
 }
コード例 #3
0
ファイル: Showfont.cs プロジェクト: skyclub66/HMI
        public unsafe static byte Showfont_XstringHZK(int x, int y, int w, int h, byte *buf)
        {
            size_tyte size_tyte = default(size_tyte);
            int       num       = (int)Showfont.myapp.brush.x;
            int       num2      = (int)Showfont.myapp.brush.y;
            byte      result;

            if ((int)buf == 0)
            {
                MessageBox.Show("error");
                result = 0;
            }
            else
            {
                try
                {
                    if ((ushort)Showfont.myapp.brush.zikuid >= Showfont.myapp.app.zimoqyt)
                    {
                        if (*buf != 0)
                        {
                            Showfont.myapp.errcode = 5;
                            result = 0;
                            return(result);
                        }
                        if (Showfont.myapp.brush.sta < 10)
                        {
                            myappinf expr_AA_cp_0 = Showfont.myapp;
                            expr_AA_cp_0.brush.sta = Convert.ToByte(expr_AA_cp_0.brush.sta + 10);
                        }
                    }
                    if (Showfont.myapp.brush.endx >= Showfont.myapp.upapp.lcddev.width)
                    {
                        Showfont.myapp.brush.endx = Convert.ToByte(Showfont.myapp.upapp.lcddev.width - 1);
                    }
                    if (Showfont.myapp.brush.endy >= Showfont.myapp.upapp.lcddev.height)
                    {
                        Showfont.myapp.brush.endy = Convert.ToByte(Showfont.myapp.upapp.lcddev.height - 1);
                    }
                    if (Showfont.myapp.brush.sta < 10)
                    {
                        myappinf expr_199_cp_0 = Showfont.myapp;
                        expr_199_cp_0.brush.sta = Convert.ToByte(expr_199_cp_0.brush.sta + 10);
                    }
                    if (Showfont.myapp.brush.sta == 0 || Showfont.myapp.brush.sta == 2 || Showfont.myapp.brush.sta == 10 || Showfont.myapp.brush.sta == 12)
                    {
                        if (Showfont.myapp.brush.backcolor >= Showfont.myapp.app.picqyt)
                        {
                            Showfont.myapp.errcode = 4;
                            result = 0;
                            return(result);
                        }
                    }
                    if (*buf == 0)
                    {
                        if (Showfont.myapp.brush.sta < 10)
                        {
                            myappinf expr_26F_cp_0 = Showfont.myapp;
                            expr_26F_cp_0.brush.sta = Convert.ToByte(expr_26F_cp_0.brush.sta + 10);
                        }
                    }
                    if (Showfont.myapp.brush.sta > 9)
                    {
                        if (Showfont.myapp.brush.sta == 11)
                        {
                            Lcd.Lcd_Fill(num, num2, (int)((ushort)((int)Showfont.myapp.brush.endx - num + 1)), (int)((ushort)((int)Showfont.myapp.brush.endy - num2 + 1)), Showfont.myapp.brush.backcolor);
                        }
                        else if (Showfont.myapp.brush.sta == 10)
                        {
                            Showpic.Showpic_ShowXpic(num, num2, (ushort)((int)Showfont.myapp.brush.endx - num + 1), (ushort)((int)Showfont.myapp.brush.endy - num2 + 1), num, num2, Showfont.myapp.brush.backcolor);
                        }
                        else if (Showfont.myapp.brush.sta == 12)
                        {
                            Showpic.Showpic_ShowPic(num, num2, Showfont.myapp.brush.backcolor);
                        }
                        if (*buf == 0)
                        {
                            result = 1;
                            return(result);
                        }
                        Showfont.myapp.brush.sta = 3;
                    }
                    if (w == 32767)
                    {
                        Showfont.myapp.brush.brendx = (short)Showfont.myapp.brush.endx;
                        Showfont.myapp.brush.brendy = (short)Showfont.myapp.brush.endy;
                        Showfont.Showfont_StringHZK((int)Showfont.myapp.brush.x, (int)Showfont.myapp.brush.y, buf, 0, ref size_tyte);
                    }
                    else
                    {
                        size_tyte.a = (ushort)w;
                        size_tyte.b = (ushort)h;
                    }
                    if (x == 32767)
                    {
                        if (Showfont.myapp.brush.xjuzhong > 0)
                        {
                            int num3 = (int)(Showfont.myapp.brush.endx - Showfont.myapp.brush.x + 1 - size_tyte.a);
                            if (num3 > 1)
                            {
                                if (Showfont.myapp.brush.xjuzhong == 1)
                                {
                                    num += (int)((ushort)(num3 / 2));
                                }
                                else
                                {
                                    num += num3;
                                }
                            }
                        }
                    }
                    else
                    {
                        num = x;
                    }
                    if (y == 32767)
                    {
                        if (Showfont.myapp.brush.yjuzhong > 0)
                        {
                            int num3 = (int)(Showfont.myapp.brush.endy - Showfont.myapp.brush.y + 1 - size_tyte.b);
                            if (num3 > 1)
                            {
                                if (Showfont.myapp.brush.yjuzhong == 1)
                                {
                                    num2 += (int)((ushort)(num3 / 2));
                                }
                                else
                                {
                                    num2 += num3;
                                }
                            }
                        }
                    }
                    else
                    {
                        num2 = y;
                    }
                    if (w != 32767)
                    {
                        Showfont.myapp.brush.brendx = (short)(num + w);
                        Showfont.myapp.brush.brendy = (short)(num2 + h);
                    }
                    Showfont.Showfont_StringHZK(num, num2, buf, 1, ref size_tyte);
                }
                catch (Exception ex)
                {
                    MessageOpen.Show("Showfont_StringHZK is error!" + ex.Message);
                }
                result = 1;
            }
            return(result);
        }