|
前几天的slider控件命名执行问题已解决,多谢.
现新问题,slider控件的设置里有最大最小值在滑动上可以正常限制,但是使用带有+-号的
显示方式可以继续加减不受上下限限制.
先贴代码:
void sliderA_callback(int32_t value)
{
aValue=value;
Serial.println(aValue);
Serial.println("A被运行");
}
超出下限运行日志(限制0-30实际可以被赋值到负数,超出范围低限,这个值确实被传过来了,并不是仅仅APP端显示错误)
20:50:07.506 -> [46740] Got: {"fromDevice":"a46ca8b1a53e11ec810c5254","data":{"setVoltage":-7}}
20:50:07.540 -> [46740] data: {"setVoltage":-7}
20:50:07.540 -> [46740] fromDevice: a46ca8b1a53e11ec810c5254
20:50:07.540 -> [46753] Authority uuid
20:50:07.540 -> [46773] available: 1
20:50:07.540 -> [46773] checkAvail: 1
20:50:07.540 -> [46773] parse data: {"setVoltage":-7}
20:50:07.574 -> [46773] defined BLINKER_ARDUINOJSON
20:50:07.574 -> [46773] autoManager begin: 0 0
20:50:07.574 -> [46786] data_rtKeyCount: 0
20:50:07.574 -> [46786] checkNum count: 2
20:50:07.574 -> [46786] intWidgetsParse isParsed
20:50:07.574 -> -7
20:50:07.574 -> A被运行
20:50:07.574 -> [46786] checkNum count: 2
20:50:07.574 -> [46799] _fresh need flush
20:50:07.574 -> [46799] isParsed
20:50:07.574 -> [46799] flush
超出上限运行日志(限制0-30.使用+-实际可以被赋值到超过上限,这个值确实被传过来了,并不是仅仅APP端显示错误)
21:10:03.761 -> [1242975] num: 1, get Text: {"setVoltage":40}, length: 17
21:10:03.761 -> [1242975] isAvail_MQTT: 1
21:10:03.795 -> [1242996] available: 1
21:10:03.795 -> [1242996] checkAvail: 1
21:10:03.795 -> [1242996] parse data: {"setVoltage":40}
21:10:03.795 -> [1242996] defined BLINKER_ARDUINOJSON
21:10:03.795 -> [1242997] autoManager begin: 0 0
21:10:03.795 -> [1243009] data_rtKeyCount: 0
21:10:03.828 -> [1243009] checkNum count: 2
21:10:03.828 -> [1243009] intWidgetsParse isParsed
21:10:03.828 -> 40
21:10:03.828 -> A被运行
21:10:03.828 -> [1243022] checkNum count: 2
21:10:03.828 -> [1243022] _fresh need flush
21:10:03.828 -> [1243022] isParsed
21:10:03.828 -> [1243022] 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端的问题,传值前先判断上下限,应该就可以解决问题
|
-
设置上下限值
-
使用-操作,面板值被减到负值
-
使用+操作,面板值被减到超出上限值
|