From d2ddc8b76ad2272f474dd8422f4d70ef263bfb5b Mon Sep 17 00:00:00 2001 From: kai60 Date: Tue, 10 May 2022 18:27:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=A1=E6=81=AF=E8=AF=BB=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../XuTo/Xuanduo2DataUtility.m | 24 ++++++++++++++++++- .../XuTo/Xuanduo2Model.h | 4 ++++ .../XuTo/Xuanduo2fController.m | 13 ++++++---- 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2DataUtility.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2DataUtility.m index 5dc5063..20db4fb 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2DataUtility.m +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2DataUtility.m @@ -39,6 +39,28 @@ { xuanduoModel.waterLevel=[dataString substringWithRange:NSMakeRange(84, 2)]; } + } + else if (([type isEqualToString:DECICE_TYPE_XUANDUO4F]||[type isEqualToString:DECICE_TYPE_XUANDUO5F])&&[model isKindOfClass:[Xuanduo2Model class]]&&dataString.length>83) + { + + Xuanduo2Model*xuanduoModel=model; + xuanduoModel.gasPump = [dataString substringWithRange:NSMakeRange(30, 4)]; + xuanduoModel.light1 = [dataString substringWithRange:NSMakeRange(34, 4)]; + xuanduoModel.light2 = [dataString substringWithRange:NSMakeRange(38, 4)]; + xuanduoModel.waterPump = [dataString substringWithRange:NSMakeRange(42, 4)]; + xuanduoModel.uvLamp = [dataString substringWithRange:NSMakeRange(46, 4)]; + xuanduoModel.waveMakingPump = [dataString substringWithRange:NSMakeRange(50, 4)]; + xuanduoModel.status = [dataString substringWithRange:NSMakeRange(54, 4)]; + xuanduoModel.heatStatus = [dataString substringWithRange:NSMakeRange(58, 2)]; + xuanduoModel.waterTemperature = [dataString substringWithRange:NSMakeRange(60, 4)]; + xuanduoModel.heatingTemperature = [dataString substringWithRange:NSMakeRange(64, 4)]; + xuanduoModel.huliLight = [dataString substringWithRange:NSMakeRange(68, 2)]; + xuanduoModel.fishFeed = [dataString substringWithRange:NSMakeRange(70, 2)]; + xuanduoModel.powerRating = [dataString substringWithRange:NSMakeRange(72, 4)]; + xuanduoModel.alarmSwitch = [dataString substringWithRange:NSMakeRange(76, 2)]; + xuanduoModel.miniTemp = [dataString substringWithRange:NSMakeRange(78, 4)]; + xuanduoModel.maxTemp = [dataString substringWithRange:NSMakeRange(82, 4)]; + } else if ([type isEqualToString:DECICE_TYPE_XUANDUO3F]&&[model isKindOfClass:[Xuanduo3fModel class]]&&dataString.length>67) { @@ -66,7 +88,7 @@ +(void)resetNewXuanduoButtonState:(UIButton*)uvLightBtn gasPumpLight:(UIButton*)gasLightBtn light1:(UIButton*)light1Btn light2:(UIButton*)light2Btn waveLight:(UIButton*)waveLightBtn huliLight:(UIButton*)huliLightBtn waterLight:(UIButton*)waterLightBtn heatLight:(UIButton*)heatLightBtn withModel:(Xuanduo2Model*)model type:(nonnull NSString *)type{ - if ([type isEqualToString:DECICE_TYPE_XUANDUO2F]) + if ([type isEqualToString:DECICE_TYPE_XUANDUO2F]||[type isEqualToString:DECICE_TYPE_XUANDUO4F]||[type isEqualToString:DECICE_TYPE_XUANDUO5F]) { Xuanduo2Model*backModel=model; diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2Model.h b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2Model.h index 796db7f..09ef9ce 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2Model.h +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2Model.h @@ -67,6 +67,10 @@ bfec crc16校验码 /// 最高温 @property (nonatomic, strong) NSString *maxTemp; @property (nonatomic, strong) NSString *waterLevel;//水位报警开关 +/// 一键喂鱼 4 5 f有 +@property (nonatomic, strong) NSString *fishFeed; +/// 功率 4 5 f有 +@property (nonatomic, strong) NSString *powerRating; diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.m index 8b7b779..6351939 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.m +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.m @@ -867,7 +867,7 @@ UInt64 mac = 0; NSLog(@"%llu",mac); - if ([self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO2F]) { + if ([self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO2F]||[self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO5F]||[self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO4F]) { Xuanduo2Model*model=(Xuanduo2Model*)self.dataModel; mac=[dataContorl hexToTen:model.waterTemperature]; } @@ -1076,13 +1076,18 @@ - (id)dataModel { if (!_dataModel) { _dataModel = nil; - if ([self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO2F]) { + + if ([self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO3F]) + { + _dataModel=[[Xuanduo3fModel alloc]init]; + } + else if([self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO2F]) { _dataModel=[[Xuanduo2Model alloc]init]; } - else if ([self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO3F]) + else { - _dataModel=[[Xuanduo3fModel alloc]init]; + _dataModel=[[Xuanduo2Model alloc]init]; } } return _dataModel;