diff --git a/idiBusMaster/IdiBus_Master_v0.26/idiBus_MasterLib/IdiBus_Master/IDIBUS_MASTER/IdiBus_Master/Sketch.cpp b/idiBusMaster/IdiBus_Master_v0.26/idiBus_MasterLib/IdiBus_Master/IDIBUS_MASTER/IdiBus_Master/Sketch.cpp index 2f8ff3d..ec9e438 100644 --- a/idiBusMaster/IdiBus_Master_v0.26/idiBus_MasterLib/IdiBus_Master/IDIBUS_MASTER/IdiBus_Master/Sketch.cpp +++ b/idiBusMaster/IdiBus_Master_v0.26/idiBus_MasterLib/IdiBus_Master/IDIBUS_MASTER/IdiBus_Master/Sketch.cpp @@ -82,13 +82,11 @@ void setup() Settings.first_mode_pwm_value = 40000; Settings.first_mode_f = 40; Settings.first_mode_invert = 1; // 0 || 1 - //Settings.first_mode_R1 = 0; // 0 || 1 Settings.second_mode_time = 1; Settings.second_mode_pwm_value = 20000; Settings.second_mode_f = 60; Settings.second_mode_invert = 1; // 0 || 1 - //Settings.second_mode_R1 = 1; // 0 || 1 uint8_t TxData[10] = {Settings.first_mode_time, (uint8_t)((Settings.first_mode_pwm_value >> 8) & 0xFF), (uint8_t)(Settings.first_mode_pwm_value & 0xFF), @@ -104,152 +102,7 @@ void setup() Serial_Line0.UpdateBaudrateFromDipSwitch(); } //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -/* -struct Statistic{ - uint32_t Ok; - uint32_t Lost; - uint32_t Broken; - uint32_t Total; -}; - -Statistic stats[6]; -uint8_t PacketCounter; -IdiBus_Test IDITEST[6]; -*/ -//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -void loop() -{ - -/* - PacketCounter = 0; - const uint8_t baseAddr = 80; - const uint8_t num = 4; - for (uint8_t addr = 0; addr < num; addr++){ - if ((addr&1) == 0) - IDITEST[addr] = IdiBus_Test(&Serial_Line0,baseAddr+(addr>>1)); - else - IDITEST[addr] = IdiBus_Test(&Serial_Line1,baseAddr+(addr>>1)); - stats[addr].Ok = 0; - stats[addr].Lost = 0; - stats[addr].Broken = 0; - stats[addr].Total = 0; - } - - for (uint8_t addr = 0; addr < num;) { - ErrorCode = IDITEST[addr].c_Init(); - delay(1000); - if (ErrorCode != IDIER_NOPE) { - Serial.print("[ERROR] Unable to init module "); - Serial.print(1<<((addr>>1)+5)); - Serial.print(" | Line "); - Serial.print(addr&1); - Serial.print(". Check the connection! \n"); - delay(1000); - } else - addr++; - } - Serial.write("[INFO] Modules inited successfully\n"); - - while(1) { - for (uint8_t id = 0; id < num; id++){ - ErrorCode = IDITEST[id].sendPacket(0); - - Statistic *stat = &stats[id]; - stat->Total++; - - if (ErrorCode == IDIERMST_RCV_TIMEOUT) { - stat->Lost++; - } else if (ErrorCode != IDIER_NOPE) { - stat->Broken++; - } else { - IDIBUS_Test_DATA_TYPE data = IDITEST[id].getChData(0); - - uint8_t fail = 0; - - for (uint16_t i = 0; i < 256; i++){ - if (data.DATA[i] != data.RNG[i]) { - fail = 1; - break; - } - } - - if (fail == 1) - stat->Broken++; - else - stat->Ok++; - } - } - - PacketCounter++; - if (PacketCounter == 8) { - for (uint8_t id = 0; id < num; id++){ - Serial.print("[INFO] Module #"); - Serial.print(baseAddr+(id>>1)); - Serial.print(" Line:"); - Serial.print(id&1); - Serial.print(" | "); - Serial.print(stats[id].Ok); - Serial.print(" | "); - Serial.print(stats[id].Lost); - Serial.print(" | "); - Serial.print(stats[id].Broken); - Serial.print(" | "); - Serial.println(stats[id].Total); - } - PacketCounter = 0; - Serial_Line0.UpdateBaudrateFromDipSwitch(); - Serial_Line1.UpdateBaudrateFromDipSwitch(); - } - } - */ -} -//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - /* - Egor code for loop function - - IdiBus_4DC IDB4DC(&Serial_Line1, 122); - - ErrorCode = IDB4DC.c_Init(); - delay(1000); - ErrorCode = IDB4DC.c_AssignGroup(IDIBUS_PSU_CNTRL_DEV, 0, 10); - ErrorCode = IDB4DC.c_AssignGroup(IDIBUS_PSU_CNTRL_DEV, 2, 10); - - uint8_t TxData; - IdiBusMMESG Group1(IDIBUS_GROUP_10_ADDR, &TxData, 1); - Group1.ComFunc = IDIBUS_CUSTDEF_FUNC_CODE_PSU_CH_SET_STATE; - - while (1) - { - Serial.write((uint8_t*)"echo", sizeof("echo")-1); - - TxData = 0; - Serial_Line1.sendMMESG(&Group1); - delay(2000); - TxData = 1; - Serial_Line1.sendMMESG(&Group1); - delay(2000); - }*/ - -/* - ErrorCode[0] = IDB4DC.c_Init(); - delay(1000); - ErrorCode[1] = IDB4DC.c_WriteSnIPv4IPv6(0xAABBCCDD, 0xA1A2A3A4, 0xA5A6A7A8, 0xB1B2B3B4, 0xB5B6B7B8); - do { ErrorCode[2] = IDB4DC.c_CheckModuleLongOp(); } - while ( (LopData = IDB4DC.getModuleLongOpData()).State == IDILONGOP_STATE_IN_PROC ); - - ErrorCode[3] = IDB4DC.INPV_DEV.getInputVoltage(); - INPV_Data = IDB4DC.INPV_DEV.getChData(); - - IDB4DC.PSUC_DEV.setAllChVoltage(5000, 6000, 7000, 8000); - IDB4DC.PSUC_DEV.setAllChState(1); - while (1) - { - IDB4DC.PSUC_DEV.setAllChState(0, 1, 0, 1); - delay(2000); - IDB4DC.PSUC_DEV.setAllChState(1, 0, 1, 0); - delay(2000); - } -*/ +void loop() {} //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- uint8_t MBOARD_POWER_SET(uint8_t juction, uint8_t set) // power channel ON/OFF {