关于slider控件赋值上下限问题
前几天的slider控件命名执行问题已解决,多谢.现新问题,slider控件的设置里有最大最小值在滑动上可以正常限制,但是使用带有+-号的
显示方式可以继续加减不受上下限限制.
先贴代码:
void sliderA_callback(int32_t value)
{
aValue=value;
Serial.println(aValue);
Serial.println("A被运行");
}
超出下限运行日志(限制0-30实际可以被赋值到负数,超出范围低限,这个值确实被传过来了,并不是仅仅APP端显示错误)
20:50:07.506 -> Got: {"fromDevice":"a46ca8b1a53e11ec810c5254","data":{"setVoltage":-7}}
20:50:07.540 -> data: {"setVoltage":-7}
20:50:07.540 -> fromDevice: a46ca8b1a53e11ec810c5254
20:50:07.540 -> Authority uuid
20:50:07.540 -> available: 1
20:50:07.540 -> checkAvail: 1
20:50:07.540 -> parse data: {"setVoltage":-7}
20:50:07.574 -> defined BLINKER_ARDUINOJSON
20:50:07.574 -> autoManager begin: 0 0
20:50:07.574 -> data_rtKeyCount: 0
20:50:07.574 -> checkNum count: 2
20:50:07.574 -> intWidgetsParse isParsed
20:50:07.574 -> -7
20:50:07.574 -> A被运行
20:50:07.574 -> checkNum count: 2
20:50:07.574 -> _fresh need flush
20:50:07.574 -> isParsed
20:50:07.574 -> flush
超出上限运行日志(限制0-30.使用+-实际可以被赋值到超过上限,这个值确实被传过来了,并不是仅仅APP端显示错误)
21:10:03.761 -> num: 1, get Text: {"setVoltage":40}, length: 17
21:10:03.761 -> isAvail_MQTT: 1
21:10:03.795 -> available: 1
21:10:03.795 -> checkAvail: 1
21:10:03.795 -> parse data: {"setVoltage":40}
21:10:03.795 -> defined BLINKER_ARDUINOJSON
21:10:03.795 -> autoManager begin: 0 0
21:10:03.795 -> data_rtKeyCount: 0
21:10:03.828 -> checkNum count: 2
21:10:03.828 -> intWidgetsParse isParsed
21:10:03.828 -> 40
21:10:03.828 -> A被运行
21:10:03.828 -> checkNum count: 2
21:10:03.828 -> _fresh need flush
21:10:03.828 -> isParsed
21:10:03.828 -> flush
当然了此问题可以自己使用代码限制来解决
//电流设定滑块
void sliderA_callback(int32_t value)
{
aValue=value;
if(aValue<0)
{
SliderA.print(0);
}
else if(aValue>30)
{
SliderA.print(30);
}
Serial.println(aValue);
Serial.println("A被运行");
}
虽然可以解决,但是对于我们小白来说并不友好
此问题只会在带有+-的slider控件出现,其他控件未测试
应该只是APP端的问题,传值前先判断上下限,应该就可以解决问题
已修复,QQ下载最新版
页:
[1]