From 45ff7b09ac766ba271e08484530862dfaed78f20 Mon Sep 17 00:00:00 2001 From: applenana <83851967+applenana@users.noreply.github.com> Date: Tue, 20 Aug 2024 15:08:00 +0800 Subject: [PATCH] =?UTF-8?q?FAMSL-beta-v1.3=E6=BA=90=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.pio/build/esp12e/src/dataPacket.cpp.o | Bin 4112 -> 5112 bytes Arduino/.pio/build/esp12e/src/led.cpp.o | Bin 2284 -> 2204 bytes Arduino/.pio/build/esp12e/src/main.cpp.o | Bin 9532 -> 11604 bytes .../.pio/build/esp12e/src/processData.cpp.o | Bin 3560 -> 3824 bytes Arduino/include/dataPacket.h | 9 +- Arduino/include/led.h | 11 +- Arduino/src/dataPacket.cpp | 44 ++++- Arduino/src/led.cpp | 9 +- Arduino/src/main.cpp | 173 ++++++++++++------ Arduino/src/processData.cpp | 26 ++- 10 files changed, 179 insertions(+), 93 deletions(-) diff --git a/Arduino/.pio/build/esp12e/src/dataPacket.cpp.o b/Arduino/.pio/build/esp12e/src/dataPacket.cpp.o index b4cb163ca668336ce519cd48c9aa1197924ea922..876f5dee7cc996bf21058ee4e54ac1bc62483840 100644 GIT binary patch literal 5112 zcma)AU2Igx8J*enVw2r9W^okK7JT={NnF+5?i!QO$SZl*-h!K5;uu?{Z4&p|yOsg} zvA*F)mD*H^l&XDbQYuxEP~^u*O&(CG=tJ7tB#Iz_0z{P@6)H%hmPmatQB{Ge;+`{i z#=gG637<4G=R0%en{Q_Bo$K{a3dL_rDTOg9o)asc5H~iUCoDvV610e~hzCXXRihRn zR-2e#oTz=aHa|Psd2D^=Z1O@#-d>txPwqcUt((rZvbX)i2KjHYr>}%!A-mXImpPM6 z%s0drS3)V2n7_9E;92KFsPnR&6LxHios)KKtDOtku_ikgZi{(wvNF~K{261Sy{Tij z$C7mit!;C$nponDlWsnin72MRhkr^v-$ze>n!BC38nQ!8AEQ2f$D2i^Q51H3O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kNxiuLT(812ArgPm@$^RV^t_h74ojRHMs z;J<3H=cUb)>f(M2-h_R-R1(?i>E4t#F>oxA&(m;E#3yo-<-2)5oA!#CeAO!qxQTn~ zhy04aPH<3;3-Y@%KaJjap^%uGnp$UE-(;R~f4#hYl{>}zSW^FJGBuJ+XH$u=tc$hp& zE>2H-Ge}(x9xyx42P{lp^|_q7Q7RWp;kGu@vL5)hsACV`_WDS5NBkZ)!@IZvPrYLq z$x|;^{>-@Ao0>L8uaS zE)_V4V={0O2J4UcxNgRn?-`W&)XVuESmgk$;g`VVv7RaOQ2j5<81*$&l`o+920ck2 zg&fK|sKT_{V6+oRQL(qMxt^Hx`!M*eaUXoW8RI@aLDd*QaR3I-Pl<|sfJ4vs6b5e&3VepXv diff --git a/Arduino/.pio/build/esp12e/src/main.cpp.o b/Arduino/.pio/build/esp12e/src/main.cpp.o index 1054c3f7f3e586f6a97ba19f8aebf744b51d6b5c..c245dec817c4c4fa9bcf75d869118a4d658c11b6 100644 GIT binary patch literal 11604 zcmcgy4RBP~dA(1oA7ED)2^mO`VRw;1j?rd!5e7Tp2>pS|f-yg-<6=uIX+dk2U1fKL zA$60C?QxPRwlPjJZ9-CwO`5cgTTh+1O`1u8@pxcLYYMfSwsOI;GbOg0%EV66G|l#$ z`@XBadKR`i)9E*J-#y>C=YIF+-FM&HD}A~v(d{^nGUlkeRoPSO!Rt}tQ>s-9npIrI zba@4QKT-f`1yVE8jYunzXwChP{kk+dTcr-B3q_UAy1836-L-l;(!&L6LKCI<=qvRn zC+?~VENFafcvao(*qM-XrE~&4sR_N#QcVXI+*RZJJL!`@DzyZhHwYW+o!6PKuV{br za-e=qlM|@8{bDKHr9u}=YmV2%UM^L0?8u#0C~OJDM+cpYE_D8t`K(w=;B=_|*8FVJt_Tl)S^I&Rg_n#bU3Qa8ud*PuM)ntgo50ANtvpc7IxuR41@6bDT3i@Z<+CeA-Rl2uZs@7MvRCW7QpdwI(-fzJgDYaBpgdRN= zdgOfQ;qlO6%-f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D#Thk=&m#YJr}=S?@_B4+p@#7nUJxIy*` zrZz7ajXEOu1GL=a)U)<6i{~aM&*y(Am>cj5!Q8yu*wmQ!OU!ZnDEuF2sWX~i1yjSE zssE?oMX1lsZ}f8zo0|6tWVe?xe3#76&?@SL+2xT*iH@Z^Y%{(a#&pC1e6xIYujc|9wb2jIiNnkO;r zGMr;1M;sKs6<9CE1$GTi4LRbV@T-AMou5TRj@ZPO5JAn04Twpvn zsUb%k6n-tR=GOq$fH6=*jyNd%I>ef%IBbb%$PovH??SAbae=jprb}>8_zvOuA=reR z(Qgo*9I??OR2uy;W^l;jS=#Xa{EOb7AHjbA1#hwReHPwr;hcrXEquhnZ(8`cg}G)- zf6iEV(!v)le9gi)Ej(@EyB6kq(epsioYH|&FEfbND^}XQ2IWS)Y%!B_W;==Lo_08m z^<>NYF?008(#n$c{|C$u6NP3R2L*SLgq_6qCx=cf1m?Zeaj(1wXWcqD?HB@6gR#LM z0aM4lLpzS(pZYh6oLPd@oq}#Hff#GhzJ(ji_!a`rlQEOK1cH6&l0*}Jv)FHrgFlsK z9M^%(J%H*q0-iy}4E!F1U2g^IQOA1x6q|a~n>hhg^_aU8Ae(@Vju^MkyjwtZ5(RjM W8Z*!3XUVJq=3@9g{KbgS8r|P5%ZWJv diff --git a/Arduino/include/dataPacket.h b/Arduino/include/dataPacket.h index 388724d..bcf3f5a 100644 --- a/Arduino/include/dataPacket.h +++ b/Arduino/include/dataPacket.h @@ -1,6 +1,7 @@ #include "CRC.h" #include "Motor.h" #include "ServoMotor.h" +#include "led.h" #pragma once class DataPacket { @@ -9,11 +10,11 @@ class DataPacket { CRC16 crc16; public: uint8_t index; // 索引 - uint8_t sequenceNumber; // 序号 - uint8_t address; // 地址 + int8_t sequenceNumber; // 序号 + int8_t address; // 地址 uint8_t length; // 长度 uint8_t commandType; // 命令号 - uint8_t content; // 内容(一字节) + byte content[512]; // 内容(至多512字节) uint8_t headCRC; // 头检验 uint8_t totalLowCRC; // 总低检验 uint8_t totalHighCRC; // 总高检验 @@ -22,5 +23,5 @@ class DataPacket { DataPacket(); // 构造函数声明 bool headCheck(); bool totalCheck(); - void sendPacket(); + void sendPacket(bool ISIO2OUT = false); }; \ No newline at end of file diff --git a/Arduino/include/led.h b/Arduino/include/led.h index ee47010..1bf0515 100644 --- a/Arduino/include/led.h +++ b/Arduino/include/led.h @@ -1,9 +1,6 @@ -#include #pragma once +#include -class Led{ -public: - Led(int ledPixels,int ledPin); - Adafruit_NeoPixel leds; - void All(unsigned int r, unsigned int g, unsigned int b); -}; +extern Adafruit_NeoPixel leds; +void ledAll(unsigned int r,unsigned int g,unsigned int b); +void ledPC(uint pixels,uint r,uint g,uint b); diff --git a/Arduino/src/dataPacket.cpp b/Arduino/src/dataPacket.cpp index d391829..9165e34 100644 --- a/Arduino/src/dataPacket.cpp +++ b/Arduino/src/dataPacket.cpp @@ -4,7 +4,6 @@ DataPacket::DataPacket() : crc8(0x39, 0x66, 0x00, false, false), crc16(0x1021, 0x913D, 0x0000, false, false) { - // 可以在这里初始化其他成员变量 } bool DataPacket::headCheck(){ @@ -16,26 +15,55 @@ bool DataPacket::headCheck(){ } bool DataPacket::totalCheck(){ - byte packet[] = {0x3D,sequenceNumber,address,length,headCRC,commandType,content}; + byte* packet = new byte[length - 2]; + packet[0] = 0x3D; + packet[1] = sequenceNumber; + packet[2] = address; + packet[3] = length; + packet[4] = headCRC; + packet[5] = commandType; + memcpy(packet + 6,content,length - 8); crc16.restart(); - crc16.add(packet, sizeof(packet)); // 计算前 12 个字节的 CRC16 校验 + crc16.add(packet, length - 2); uint16_t totalCRC = crc16.calc(); uint8_t lowCRC = totalCRC & 0xFF; // 低字节 uint8_t highCRC = (totalCRC >> 8) & 0xFF; // 高字节 + delete[] packet; return (lowCRC == totalLowCRC and highCRC == totalHighCRC); } -void DataPacket::sendPacket(){ +void DataPacket::sendPacket(bool ISIO2OUT){ byte head[] = {0x3D,sequenceNumber,address,length}; crc8.restart(); crc8.add(head,4); headCRC = crc8.calc(); - byte packet[] = {0x3D,sequenceNumber,address,length,headCRC,commandType,content}; + byte* packet = new byte[length]; + packet[0] = 0x3D; + packet[1] = sequenceNumber; + packet[2] = address; + packet[3] = length; + packet[4] = headCRC; + packet[5] = commandType; + memcpy(packet + 6,content,length - 8); crc16.restart(); - crc16.add(packet, sizeof(packet)); // 计算前 12 个字节的 CRC16 校验 + crc16.add(packet, length - 2); uint16_t totalCRC = crc16.calc(); totalLowCRC = totalCRC & 0xFF; // 低字节 totalHighCRC = (totalCRC >> 8) & 0xFF; // 高字节 - byte finalPacket[] = {0x3D,sequenceNumber,address,length,headCRC,commandType,content,totalLowCRC,totalHighCRC}; - Serial.write(finalPacket, sizeof(finalPacket)); + packet[length - 2] = totalLowCRC; + packet[length - 1] = totalHighCRC; + if (ISIO2OUT){ + pinMode(2,SPECIAL); + Serial1.write(packet, length); + //delay(1); + Serial1.flush(); + pinMode(2,INPUT); + ledPC(1,0,255,0); + }else{ + Serial.write(packet, length); + ledPC(1,0,0,255); + } + delay(1); + delete[] packet; + ledPC(1,0,0,0); } \ No newline at end of file diff --git a/Arduino/src/led.cpp b/Arduino/src/led.cpp index 9a14755..0ac14fa 100644 --- a/Arduino/src/led.cpp +++ b/Arduino/src/led.cpp @@ -1,10 +1,11 @@ #include "led.h" -Led::Led(int ledPixels,int ledPin){ - Adafruit_NeoPixel leds(ledPixels, ledPin, NEO_GRB + NEO_KHZ800); +void ledAll(unsigned int r,unsigned int g,unsigned int b){ + leds.fill(leds.Color(r,g,b)); + leds.show(); } -void Led::All(unsigned int r, unsigned int g, unsigned int b){ - leds.fill(leds.Color(r,g,b)); +void ledPC(uint pixels,uint r,uint g,uint b){ + leds.setPixelColor(pixels,leds.Color(r,g,b)); leds.show(); } \ No newline at end of file diff --git a/Arduino/src/main.cpp b/Arduino/src/main.cpp index dc250b5..4cdaf99 100644 --- a/Arduino/src/main.cpp +++ b/Arduino/src/main.cpp @@ -3,83 +3,134 @@ #include "processData.h" #include "ServoMotor.h" #include "Motor.h" +#include +#include "led.h" DataPacket datapacket; ServoMotor sv(13); //构建舵机对象(选择13引脚为pwm输出引脚) Motor mc(4,5); //构建电机对象(选择4和5引脚控制电机驱动) +Adafruit_NeoPixel leds(3, 12, NEO_GRB + NEO_KHZ800);//构建leds对象(3个led,12号引脚) unsigned int FilamentIoPin = A0; //断料检测引脚(ADC=>A0) String FilamentState = "none"; //断料状态 +bool IsFPinHigh;//ADC是否高电平 -void FilamentChange();//断料检测中断函数 +void FilamentChange(bool ToStateIsHigh); void setup() { - Serial.begin(112500); + Serial.begin(115200,SERIAL_8E1); + Serial1.begin(115200,SERIAL_8E1); + leds.begin(); - //设置断料检测 - pinMode(FilamentIoPin, INPUT_PULLDOWN_16); - attachInterrupt(FilamentIoPin,FilamentChange,CHANGE); + IsFPinHigh = (analogRead(A0) > 1000); + if (IsFPinHigh){FilamentState = "exist";} + else{FilamentState = "inexist";} + leds.setBrightness(100); + leds.clear(); + leds.show(); } void loop() { - if (datapacket.index == 0 and Serial.read() == 0x3D){ - datapacket.index += 1; - }else if (Serial.read() != -1 and datapacket.index > 0 and datapacket.index <= 4){ - switch (datapacket.index){ - case 1: - datapacket.sequenceNumber = Serial.read(); - break; - case 2: - datapacket.address = Serial.read(); - break; - case 3: - datapacket.length = Serial.read(); - break; - case 4: - datapacket.headCRC = Serial.read(); - break; + if ((analogRead(A0) > 1000) != IsFPinHigh){ + FilamentChange(not IsFPinHigh); + IsFPinHigh = not IsFPinHigh; } - datapacket.index += 1; - }else if (Serial.read() != -1 and datapacket.index == 5){ - if (datapacket.totalCheck()){ - datapacket.content = Serial.read(); - datapacket.contentlength += 1; - datapacket.index += 1; - }else{ - datapacket.index = 0; - } - }else if (Serial.read() != -1 and datapacket.index >= datapacket.length - 2 and datapacket.index < datapacket.length){ - datapacket.index += 1; - if (datapacket.index == datapacket.length - 2){ - datapacket.totalLowCRC = Serial.read(); - }else if (datapacket.index == datapacket.length -1){ - datapacket.totalHighCRC = Serial.read(); - } - }else if (datapacket.index == datapacket.length){ - if (datapacket.totalCheck()){ - processData(datapacket); - datapacket.index = 0; - }else{ - datapacket.index = 0; + + if (datapacket.index == 0 and Serial.read() == 0x3D){ + //Serial.println("帧头"); + datapacket.index += 1; + datapacket.contentlength = 0; + ledPC(0,0,255,0); + }else if (Serial.available() and datapacket.index > 0 and datapacket.index <= 4){ + //Serial.println("读取序号,地址,长度,headCRC"); + switch (datapacket.index){ + case 1: + datapacket.sequenceNumber = Serial.read(); + //Serial.println(datapacket.sequenceNumber,HEX); + break; + ledPC(0,0,0,0); + case 2: + datapacket.address = Serial.read(); + //Serial.println(datapacket.address,HEX); + ledPC(0,0,255,0); + break; + case 3: + datapacket.length = Serial.read(); + //Serial.println(datapacket.length,HEX); + ledPC(0,0,0,0); + break; + case 4: + datapacket.headCRC = Serial.read(); + //Serial.println(datapacket.headCRC,HEX); + ledPC(0,0,255,0); + break; + } + datapacket.index += 1; + }else if (Serial.available() and datapacket.index == 5){ + //Serial.println("检验头"); + if (datapacket.headCheck()){ + datapacket.commandType = Serial.read(); + datapacket.index += 1; + //Serial.println("检验头success|读取命令号"); + //Serial.println(datapacket.commandType,HEX); + ledPC(0,0,0,0); + }else{ + datapacket.index = 0; + //Serial.println("检验头失败"); + ledPC(0,255,0,0); + } + }else if (Serial.available() and datapacket.index >= 6 and datapacket.index <= datapacket.length - 3){ + //Serial.println("读取内容"); + ledPC(0,0,255,0); + datapacket.content[datapacket.contentlength] = Serial.read(); + //Serial.println(datapacket.content[datapacket.contentlength],HEX); + datapacket.index += 1; + datapacket.contentlength += 1; + }else if (Serial.available() and datapacket.index >= datapacket.length - 2 and datapacket.index < datapacket.length){ + //Serial.println("读取总CRC"); + if (datapacket.index == datapacket.length - 2){ + datapacket.totalLowCRC = Serial.read(); + //Serial.println("读取低CRC"); + //Serial.println(datapacket.totalLowCRC,HEX); + ledPC(0,0,0,0); + }else if (datapacket.index == datapacket.length -1){ + datapacket.totalHighCRC = Serial.read(); + //Serial.println("读取高CRC"); + //Serial.println(datapacket.totalHighCRC,HEX); + ledPC(0,0,255,0); + } + datapacket.index += 1; + }else if (datapacket.index == datapacket.length and datapacket.index != 0){ + //Serial.println("进入最后处理"); + //Serial.println(FilamentState); + if (datapacket.totalCheck()){ + //Serial.println("进入最后处理,success"); + ledPC(0,0,0,0); + processData(datapacket); + datapacket.index = 0; + }else{ + //Serial.println("进入最后处理,fail"); + datapacket.index = 0; + ledPC(0,255,0,0); + } } - } } -void FilamentChange(){ - if (digitalRead(FilamentIoPin) == HIGH){ - //低变高-无变有 - if (FilamentState == "none" or FilamentState == "inexist"){ - FilamentState = "exist"; - }else if (FilamentState == "busy"){ - mc.stop(); - sv.pull(); - FilamentState = "exist"; +void FilamentChange(bool ToStateIsHigh){ + if (ToStateIsHigh){ + //低变高-无变有 + if (FilamentState == "none" or FilamentState == "inexist"){ + FilamentState = "exist"; + }else if (FilamentState == "busy"){ + mc.stop(); + sv.pull(); + FilamentState = "exist"; } - }else if(digitalRead(FilamentIoPin) == LOW){ - //高变低-有变无 - if (FilamentState == "none" or FilamentState == "exist"){ - FilamentState = "inexist"; - }else if (FilamentState == "busy"){ - mc.forward(); - } - } + }else if(not ToStateIsHigh){ + //高变低-有变无 + if (FilamentState == "none" or FilamentState == "exist"){ + FilamentState = "inexist"; + }else if (FilamentState == "busy"){ + mc.forward(); + } + } } \ No newline at end of file diff --git a/Arduino/src/processData.cpp b/Arduino/src/processData.cpp index 4d408f7..38c0e5d 100644 --- a/Arduino/src/processData.cpp +++ b/Arduino/src/processData.cpp @@ -3,18 +3,22 @@ void processData(DataPacket data){ if (data.sequenceNumber >= data.address){ //执行指令并回复 + uint8_t originLength = data.length; + uint8_t originCommandType = data.commandType; + byte originContent[512]; + memcpy(originContent, data.content, 512);// 复制内容 + switch (data.commandType){ case 0x00: data.length = 0x09; data.commandType = 0x80; - if (FilamentState == "inexist"){data.content = 0x0F;} - else if (FilamentState == "exist"){data.content = 0xF0;} - else if (FilamentState == "busy"){data.content = 0xF1;} - data.sendPacket(); - + if (FilamentState == "inexist"){data.content[0] = 0x0F;} + else if (FilamentState == "exist"){data.content[0] = 0xF0;} + else if (FilamentState == "busy"){data.content[0] = 0xF1;} + data.sendPacket(true); break; case 0x01: - switch (data.content){ + switch (data.content[0]){ case 0xF0://送出 sv.push(); mc.forward(); @@ -34,14 +38,18 @@ void processData(DataPacket data){ data.length = 0x09; data.commandType = 0x81; - data.content = 0x00; - data.sendPacket(); + data.content[0] = 0x00; + data.sendPacket(true); //发送回应数据包 break; } - } + data.length = originLength; + data.commandType = originCommandType; + memcpy(data.content, originContent, 512); + } + if (data.sequenceNumber != data.address){ //转发数据包 data.sequenceNumber += 1;