0%

有时子窗体的操作需要实时调用父窗体中的控件操作,比如在父窗体的文本框中显示子窗体中的输出:

主窗体:

MainForm.cs:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
public partial class MainForm : Form  
{
public MainForm()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
SubForm SubForm = new SubForm();

// 3.将ChangeTextVal加入到委托事件中
// 等效于:
// SubForm.ChangeTextVal += ChangeTextVal;
SubForm.ChangeTextVal += new DelegateChangeTextVal(ChangeTextVal);
SubForm.ShowDialog();
}

public void ChangeTextVal(string TextVal)
{
this.textBox1.Text = TextVal;
}
}
阅读全文 »

有时我们需要在ESP32启动的时候使用一些初始化的文件,我们可以通过spiffsgen.py制作spiffs文件系统的镜像并烧写到系统里面去。

1制作spiffs文件系统镜像

我们首先要创建一个文件夹,然后把我们我们需要初始化的文件放到这个文件夹里面。
我们制作的工具是spiffsgen.py,在ESP-IDF\components\spiffs

1
2
python spiffsgen.py <image_size> <base_dir> <output_file>
python D:\Program\ESP-IDF\components\spiffs\spiffsgen.py 0x60000 spiffs_dir spiffs.bin

阅读全文 »

我们在调试TI的cc系列的芯片时经常会用到CC-DEBUGGER,CC-DEBUGGER的接口中带有SPI调试接口,如果我们是在批量生产时这个接口有时会使用不到,因此需要将下载接口进行简化,下面是主要的接线说明,
调试下载接口:

阅读全文 »

前言

最近在做一款热风枪需要测量温度,所以用到了MAX6675这款K型热电偶测量芯片,MAX6675执行冷端补偿,并数字化K型热电偶的信号。 数据以SPI™兼容的12位分辨率,只读格式输出。
该转换器分辨率为0.25°C,允许读数高达+ 1024°C,并且在0°C至+ 700°C的温度范围内具有8LSB的热电偶精度。

阅读全文 »

ArduinoIDE会默认把开发板库文件存放在

1
C:\Users\你自己的管理员文件夹\AppData\Local\Arduino15\packages

想要换只需在Arduino的安装目录下新建一个文件夹,重命名为portable 重启IDE,看到如下位置变更就成功了。

阅读全文 »

在home-assistant安装node-red插件后,在配置注意以下:
1、credential_secret随便编写英文字母即可,username和password(注意有两个)需单独设定并且不能与hass账号密码重复,password最好设置为大小写字母跟数字的组合,ssl没有开启的话设置为false(truce可以试试看),设置完成后点击save。
2、点击start运行插件并查看下方log信息(可通过刷新更新log信息),确保『Node-RED』插件正常运行后才可以点击“OPEN WEB UI”。有可能需要重启就正常啦。
3、登录时用的账户密码是hass的账户和密码,不是配置时设定的账户和密码

我们调试ESP32都知道,在idf monitor中,如果出现Guru Meditation Error 错误时,会看到错误出现的具体文件函数以及代码行数。如下这样:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Guru Meditation Error of type StoreProhibited occurred on core  0. Exception was unhandled.
Register dump:
PC : 0x400f360d PS : 0x00060330 A0 : 0x800dbf56 A1 : 0x3ffb7e00
0x400f360d: do_something_to_crash at /home/gus/esp/32/idf/examples/get-started/hello_world/main/./hello_world_main.c:57
(inlined by) inner_dont_crash at /home/gus/esp/32/idf/examples/get-started/hello_world/main/./hello_world_main.c:52
A2 : 0x3ffb136c A3 : 0x00000005 A4 : 0x00000000 A5 : 0x00000000
A6 : 0x00000000 A7 : 0x00000080 A8 : 0x00000000 A9 : 0x3ffb7dd0
A10 : 0x00000003 A11 : 0x00060f23 A12 : 0x00060f20 A13 : 0x3ffba6d0
A14 : 0x00000047 A15 : 0x0000000f SAR : 0x00000019 EXCCAUSE: 0x0000001d
EXCVADDR: 0x00000000 LBEG : 0x4000c46c LEND : 0x4000c477 LCOUNT : 0x00000000

Backtrace: 0x400f360d:0x3ffb7e00 0x400dbf56:0x3ffb7e20 0x400dbf5e:0x3ffb7e40 0x400dbf82:0x3ffb7e60 0x400d071d:0x3ffb7e90
0x400f360d: do_something_to_crash at /home/gus/esp/32/idf/examples/get-started/hello_world/main/./hello_world_main.c:57
(inlined by) inner_dont_crash at /home/gus/esp/32/idf/examples/get-started/hello_world/main/./hello_world_main.c:52
0x400dbf56: still_dont_crash at /home/gus/esp/32/idf/examples/get-started/hello_world/main/./hello_world_main.c:47
0x400dbf5e: dont_crash at /home/gus/esp/32/idf/examples/get-started/hello_world/main/./hello_world_main.c:42
0x400dbf82: app_main at /home/gus/esp/32/idf/examples/get-started/hello_world/main/./hello_world_main.c:33
0x400d071d: main_task at /home/gus/esp/32/idf/components/esp32/./cpu_start.c:254
阅读全文 »

因为HDMI I2S & CODEC I2S 在芯片内部都是同一个I2S,因此CODEC有声音时候,也有声音通过I2S 发送到HDMI,这样取消掉HDMI Audio 检测即可实现HDMI和codec 喇叭同时输出。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
diff --git a/services/java/com/android/server/WiredAccessoryManager.java b/services/java/com/android/server/WiredAccessoryManager.java

index c8d3510..2fb231e 100644

--- a/services/java/com/android/server/WiredAccessoryManager.java

+++ b/services/java/com/android/server/WiredAccessoryManager.java

@@ -374,7 +374,7 @@ final class WiredAccessoryManager implements WiredAccessoryCallbacks {

//

// If the kernel does not have an "hdmi_audio" switch, just fall back on the older

// "hdmi" switch instead.

- uei = new UEventInfo(NAME_HDMI_AUDIO, BIT_HDMI_AUDIO, 0);

+/* uei = new UEventInfo(NAME_HDMI_AUDIO, BIT_HDMI_AUDIO, 0);

if (uei.checkSwitchExists()) {

retVal.add(uei);

} else {

@@ -385,7 +385,7 @@ final class WiredAccessoryManager implements WiredAccessoryCallbacks {

Slog.w(TAG, "This kernel does not have HDMI audio support");

}

}
+*/
return retVal;
}

需求
在高版本的SDK中, 第三方应用申请悬浮窗的权限受到了过一步的限制.
除了要在应用中声明对权限的申请:

1
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

还需要打开设置中的权限:

应用可以通过代码检测权限是否已获取:

1
2
3
4
5
AppOpsManager opsMgr = (AppOpsManager)getSystemService(APP_OPS_SERVICE);
int res = opsMgr.checkOp(AppOpsManager.OPSTR_SYSTEM_ALERT_WINDOW, Process.myUid(), getPackageName());
if(res != AppOpsManager.MODE_ALLOWED){
showToast(AppOpsManager.OPSTR_SYSTEM_ALERT_WINDOW + " not allowed");
}

有可能会抛出异常:
1
java.lang.SecurityException: com.android.myapp from uid 10066 not allowed to perform SYSTEM_ALERT_WINDOW

若需要默认打开, 需要修改相关代码
阅读全文 »