features:4月新绚多设备适配 & 修复一些已知bug

This commit is contained in:
一只会编程的狮子
2019-05-15 20:24:53 +08:00
parent 4b74588759
commit c586949438
59 changed files with 2912 additions and 130 deletions
@@ -29,8 +29,14 @@
#import "XuToControlName.h"
#import "RuiMeiCHNameCustom.h"
#import "RuiMeiCHControl.h"
#import "Xuanduo2DataUtility.h"
#import "NSString+Add.h"
#define ktempTag 600
@implementation MonitorBootmView
{
NSTimer *_switchTimer;
}
-(id)initWithFrame:(CGRect)frame
{
@@ -610,7 +616,9 @@
} else if ([self.device.type isEqualToString:DECICE_TYPE_RUIMEI]) {
return 3 + 5;
} else {
} else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO2F]){
return 3 + self.device.controlAmount.integerValue + 1;
}else {
if (self.device.controlAmount.integerValue ==5) {
@@ -690,7 +698,30 @@
withData:self.device
addMassglength:self.dataLength];
}else{
}else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO2F]){
if (!_xuanduoBack) {
[self makeToast:@"暂未连接"];
return;
}
if (indexPath.row == 1) {
FishControlSecondCell *cell = [self.collectionView viewWithTag:ktempTag];
if (!cell || [cell.templabel.text containsString:@"kwh"]) {
return;
}
UInt64 mac = [dataContorl hexToTen:_xuanduoBack.electricity];
NSString *stringTemp = [NSString stringWithFormat:@"%llukwh",mac];
cell.templabel.font = [UIFont systemFontOfSize:37];
cell.templabel.textColor = RGB(253, 188, 63);
[cell.templabel setAttributedText:[NSString ls_changeFontAndColor:[UIFont systemFontOfSize:17] Color:nil TotalString:stringTemp SubStringArray:@[@"kwh"]]];
if (!_switchTimer) {
_switchTimer = [NSTimer timerWithTimeInterval:3.0 target:self selector:@selector(changeTemp) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:_switchTimer forMode:NSRunLoopCommonModes];
}
}else if(indexPath.row == 2) {
[self.MonitorBottomDelegate didselectXuanduo2SetttngWithData:self.device andBackModel:_xuanduoBack];
}
}
else{
int controlAmount=[self.device.controlAmount intValue];
switch (controlAmount) {
@@ -894,6 +925,20 @@
}
[self makeToastActivity];
}else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO2F]){
// 新绚多
if (!_xuanduoBack) {
[self makeToast:@"暂未连接"];
return;
}
if (indexPath.row == 10 || indexPath.row == 3) {
//点击加热棒
[self.MonitorBottomDelegate selectXuanduo2Index:indexPath withBackModel:_xuanduoBack];
}else{
[BootomViewSoketBackMasgConreol XuTo2ControlCommandSelectorWithBackModel73:_xuanduoBack atindexPath:indexPath];
}
[self makeToastActivity];
}else{
int controlAmount=[self.device.controlAmount intValue];
@@ -1062,6 +1107,25 @@
}
- (void)changeTemp {
[self setTemperature];
[_switchTimer invalidate];
_switchTimer = nil;
}
- (void)setTemperature {
FishControlSecondCell *cell = [self.collectionView viewWithTag:ktempTag];
if (!cell) {
return;
}
UInt64 mac = [dataContorl hexToTen:_xuanduoBack.waterTemperature];
NSLog(@"%llu",mac);
//float TPlabel=mac/10+(mac%10)*0.1;
float temp = mac/10.0;
NSString *stringTemp = [NSString stringWithFormat:@"%.1f",temp];
[cell setTemWith:stringTemp];
}
#pragma mark 加载脚步视图
//- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{
@@ -1116,7 +1180,7 @@
//温度
FishControlSecondCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"FishControlSecondCell" forIndexPath:indexPath];
cell.tag = ktempTag;
cell.backgroundColor = [UIColor whiteColor];
[cell setTemWith:self.temperature];
@@ -1179,6 +1243,14 @@
[cell setSongNuoBDControBtnImg:self.btnImgArr addArr:self.btnOnImgArr atIndex:indexPath addBackModel:_songNuoBDBack];
}else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO2F]){
if (!_xuanduoBack) {
cell.controBtnImg.image = self.btnImgArr[indexPath.row - 3];
[self makeToast:@"连接设备中..."];
}else {
[cell setXuanduo2ControBtnImg:self.btnImgArr addArr:self.btnOnImgArr atIndex:indexPath addBackModel:_xuanduoBack];
}
}else{
int controlAmount=[self.device.controlAmount intValue];
@@ -1395,7 +1467,27 @@
LXImageWithImageName(@"bootview_co2_on"),
LXImageWithImageName(@"bootview_heat_on")];
} else{
}else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO2F]){
self.btnNameArr = @[@"循环泵",@"增氧泵",@"灯光1",@"灯光2",@"造浪泵",@"杀菌灯",@"护理灯",@"加热棒"];
self.btnImgArr = @[[UIImage imageNamed:@"xunhuan_noraml"],
[UIImage imageNamed:@"zengyang_noraml"],
[UIImage imageNamed:@"dengguang_normal"],
[UIImage imageNamed:@"dengguang_normal"],
[UIImage imageNamed:@"zaolang_normal"],
[UIImage imageNamed:@"shajun_normal"],
[UIImage imageNamed:@"huli_noraml"],
[UIImage imageNamed:@"jiare_normal"]];
self.btnOnImgArr = @[[UIImage imageNamed:@"xunhuan_selected"],
[UIImage imageNamed:@"zengyang_selected"],
[UIImage imageNamed:@"dengguang_selected"],
[UIImage imageNamed:@"dengguang_selected"],
[UIImage imageNamed:@"zaolang_selectd"],
[UIImage imageNamed:@"shajun_selected"],
[UIImage imageNamed:@"huli_selected"],
[UIImage imageNamed:@"jiare_selected"]];
}else{
int controlAmount=[self.device.controlAmount intValue];
@@ -1702,6 +1794,14 @@
addMassglength:string1.length];
}else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO2F]){
// 新绚多
if (!_xuanduoBack) {
_xuanduoBack = [[Xuanduo2Model alloc] init];
}
[Xuanduo2DataUtility readSocketDataWithBackMsgModel:_xuanduoBack addWithBackData:data];
self.temperature = [BootomViewSoketBackMasgConreol getTempNewWayWithSoketData:data adddeviceType:DECICE_TYPE_XUANDUO2F];
[self.collectionView reloadData];
}else{
int controlAmount=[devicemoel.controlAmount intValue];