OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 2571|回复: 2

emwin用手机APP通过WiFi控制电脑硬件

[复制链接]

1

主题

1

帖子

0

精华

新手上路

积分
24
金钱
24
注册时间
2017-5-16
在线时间
3 小时
发表于 2017-5-16 15:40:26 | 显示全部楼层 |阅读模式
1金钱
求助
我的emwin显示ad采样和 用手机通过WiFi控制f1硬件的程序不能用这是为什么
(就是一按下那个使WiFi控制的按钮就卡屏而且手机也不能不能控制)
下面是那个WiFi那个按键的程序
#include "DIALOG.h"
#include "WIFI.h"
#include "Mylove.h"
#include "..\User\bsp_adc\bsp_adc.h"
#include "bsp_esp8266.h"
#include "..\User\Test\test.h"

*/
#define ID_FRAMEWIN_0 (GUI_ID_USER + 0x00)
#define ID_BUTTON_0 (GUI_ID_USER + 0x02)
#define ID_BUTTON_1 (GUI_ID_USER + 0x03)
#define ID_BUTTON_2 (GUI_ID_USER + 0x04)

// USER START (Optionally insert additional defines)
// USER END
/*********************************************************************
*
*       Static data
*
**********************************************************************
*/
// USER START (Optionally insert additional static data)
// USER END
/*********************************************************************
*
*       _aDialogCreate
*/
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
  { FRAMEWIN_CreateIndirect, "WIFI", ID_FRAMEWIN_0, 0, 0, 240, 320, 0, 0x0, 0 },
  { BUTTON_CreateIndirect, "PC", ID_BUTTON_0, 40, 50, 130, 40, 0, 0x0, 0 },
  { BUTTON_CreateIndirect, "Cell", ID_BUTTON_1, 40, 120, 130, 40, 0, 0x0, 0 },
  { BUTTON_CreateIndirect, "Back", ID_BUTTON_2, 40, 180, 130, 40, 0, 0x0, 0 },
  // USER START (Optionally insert additional widgets)
  // USER END
};
char flag1;
/*********************************************************************
*
*       Static code
*
**********************************************************************
*/
// USER START (Optionally insert additional static code)
// USER END
/*********************************************************************
*
*       _cbDialog
*/
static void _cbDialog(WM_MESSAGE * pMsg) {
  int NCode;
  int Id;
WM_HWIN hItem;
  // USER START (Optionally insert additional variables)
  // USER END
  switch (pMsg->MsgId) {
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;
   hItem = pMsg->hWin;
   FRAMEWIN_SetTitleHeight(hItem, 30);
   FRAMEWIN_SetText(hItem, "WIFI");
   FRAMEWIN_SetFont(hItem, GUI_FONT_24_ASCII);
   FRAMEWIN_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
   FRAMEWIN_SetTextColor(hItem, 0x0000FFFF);
  //Initialization of 'BUTTON'
   hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
   BUTTON_SetFont(hItem, GUI_FONT_24_ASCII);
   BUTTON_SetText(hItem, "PC");
   hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1);
   BUTTON_SetFont(hItem, GUI_FONT_24_ASCII);
   BUTTON_SetText(hItem, "Cell");
   
   hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_2);
   BUTTON_SetFont(hItem, GUI_FONT_24_ASCII);
   BUTTON_SetText(hItem, "Back");
    switch(Id) {
    case ID_BUTTON_0: // Notifications sent by 'ToComputer'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_BUTTON_1: // Notifications sent by 'Mobile'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
     flag1='1';
    while(flag1=='1'){
     GUI_Delay(100);
     macESP8266_USART_APBxClock_FUN ( macESP8266_USART_CLK, ENABLE );//ʹÄÜ´®¿Ú3
     ESP8266_StaTcpClient_UnvarnishTest ();//ÊÖ»úAPP¿Éͨ¹ýWIFI¿ØÖÆÓ²¼þµÄº¯Êý
     GUI_Delay(100);
      }
//   
      
      
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
    //WM_InvalidateWindow(WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1)); //Öػ汳¾°´°¿Ú
        //WM_Exec();//ͨ¹ýÖ´Ðлص÷ÖØ»æÎÞЧ´°¿Ú£¨ËùÓй¤×÷£©
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_BUTTON_2: // Notifications sent by 'HomePage'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
    macESP8266_USART_APBxClock_FUN ( macESP8266_USART_CLK, DISABLE );
    flag1='0';
    //macESP8266_USART_APBxClock_FUN ( macESP8266_USART_CLK, DISABLE );

      photo_Demo();
   
        // USER START (Optionally insert code for reacting on notification message)
        // USER END//     GUI_Delay(100);//    GUI_Clear();
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    // USER START (Optionally insert additional code for further Ids)
    // USER END
    }
    break;
  // USER START (Optionally insert additional message handling)
  // USER END
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}
/*********************************************************************
*
*       Public code
*
**********************************************************************
*/
/*********************************************************************
*
*       CreateWIFI
*/
WM_HWIN CreateWIFI(void);
WM_HWIN CreateWIFI(void) {
  WM_HWIN hWin;
  hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);
  return hWin;
}
void WIFI_Demo(void)
{
CreateWIFI();
// WM_HWIN hWin;
//hWin=CreateFramewin();//ÉÏÃæµÄÒ»Ðб¾À´ÓÉÔ ÏÈ×¢Ê͵ÄÁ½ÐдúÌæ
while(1)
{
  GUI_ExecDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);
  
  GUI_Delay(100);
}
}
// USER START (Optionally insert additional public code)
// USER END
/*************************** End of file ****************************/



Module_code.rar

9.02 MB, 下载次数: 72

正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

530

主题

11万

帖子

34

精华

管理员

Rank: 12Rank: 12Rank: 12

积分
165309
金钱
165309
注册时间
2010-12-1
在线时间
2108 小时
发表于 2017-5-16 21:07:17 | 显示全部楼层
回复

使用道具 举报

0

主题

10

帖子

0

精华

新手上路

积分
30
金钱
30
注册时间
2020-6-28
在线时间
10 小时
发表于 2020-10-26 19:54:50 | 显示全部楼层
帮顶帮顶帮顶
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2024-11-22 11:21

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表