Skip to content

Commit

Permalink
[FAMSL]-beta-1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
applenana committed Nov 14, 2024
1 parent 45ff7b0 commit 5614d2d
Show file tree
Hide file tree
Showing 21 changed files with 87 additions and 15 deletions.
Binary file modified Arduino/.pio/build/esp12e/.sconsign311.dblite
Binary file not shown.
Binary file modified Arduino/.pio/build/esp12e/firmware.bin
Binary file not shown.
Binary file modified Arduino/.pio/build/esp12e/firmware.elf
Binary file not shown.
1 change: 1 addition & 0 deletions Arduino/.pio/build/esp12e/idedata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"build_type": "release", "env_name": "esp12e", "libsource_dirs": ["c:\\Users\\applenana\\Desktop\\ams\u9879\u76ee\\arduino\\FAMSL\\lib", "c:\\Users\\applenana\\Desktop\\ams\u9879\u76ee\\arduino\\FAMSL\\.pio\\libdeps\\esp12e", "C:\\Users\\applenana\\.platformio\\lib", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries"], "defines": ["PLATFORMIO=60116", "ESP8266", "ARDUINO_ARCH_ESP8266", "ARDUINO_ESP8266_ESP12", "F_CPU=80000000L", "__ets__", "ICACHE_FLASH", "_GNU_SOURCE", "ARDUINO=10805", "ARDUINO_BOARD=\"PLATFORMIO_ESP12E\"", "ARDUINO_BOARD_ID=\"esp12e\"", "FLASHMODE_DIO", "LWIP_OPEN_SRC", "NONOSDK22x_190703=1", "TCP_MSS=536", "LWIP_FEATURES=1", "LWIP_IPV6=0", "VTABLES_IN_FLASH", "MMU_IRAM_SIZE=0x8000", "MMU_ICACHE_SIZE=0x8000"], "includes": {"build": ["c:\\Users\\applenana\\Desktop\\ams\u9879\u76ee\\arduino\\FAMSL\\include", "c:\\Users\\applenana\\Desktop\\ams\u9879\u76ee\\arduino\\FAMSL\\src", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\Servo\\src", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\LittleFS\\src", "c:\\Users\\applenana\\Desktop\\ams\u9879\u76ee\\arduino\\FAMSL\\.pio\\libdeps\\esp12e\\ServoEasing\\src", "c:\\Users\\applenana\\Desktop\\ams\u9879\u76ee\\arduino\\FAMSL\\.pio\\libdeps\\esp12e\\Adafruit NeoPixel", "c:\\Users\\applenana\\Desktop\\ams\u9879\u76ee\\arduino\\FAMSL\\.pio\\libdeps\\esp12e\\CRC\\src", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\tools\\sdk\\include", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\cores\\esp8266", "C:\\Users\\applenana\\.platformio\\packages\\toolchain-xtensa\\include", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\tools\\sdk\\lwip2\\include", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\variants\\nodemcu"], "compatlib": ["c:\\Users\\applenana\\Desktop\\ams\u9879\u76ee\\arduino\\FAMSL\\.pio\\libdeps\\esp12e\\Adafruit NeoPixel", "c:\\Users\\applenana\\Desktop\\ams\u9879\u76ee\\arduino\\FAMSL\\.pio\\libdeps\\esp12e\\CRC\\src", "c:\\Users\\applenana\\Desktop\\ams\u9879\u76ee\\arduino\\FAMSL\\.pio\\libdeps\\esp12e\\ServoEasing\\src", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\LittleFS\\src", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\Servo\\src", "c:\\Users\\applenana\\Desktop\\ams\u9879\u76ee\\arduino\\FAMSL\\.pio\\libdeps\\esp12e\\ArduinoJson\\src", "c:\\Users\\applenana\\Desktop\\ams\u9879\u76ee\\arduino\\FAMSL\\.pio\\libdeps\\esp12e\\PubSubClient\\src", "c:\\Users\\applenana\\Desktop\\ams\u9879\u76ee\\arduino\\FAMSL\\.pio\\libdeps\\esp12e\\Unity\\src", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\ArduinoOTA", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\DNSServer\\src", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\EEPROM", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\ESP8266AVRISP\\src", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\ESP8266HTTPClient\\src", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\ESP8266HTTPUpdateServer\\src", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\ESP8266LLMNR", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\ESP8266NetBIOS", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\ESP8266SSDP", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\ESP8266SdFat\\src", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\ESP8266WebServer\\src", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\ESP8266WiFi\\src", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\ESP8266WiFiMesh\\src", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\ESP8266httpUpdate\\src", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\ESP8266mDNS\\src", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\Ethernet\\src", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\FSTools", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\GDBStub\\src", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\Hash\\src", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\I2S\\src", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\Netdump\\src", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\SD\\src", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\SDFS\\src", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\SPI", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\SPISlave\\src", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\SoftwareSerial\\src", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\TFT_Touch_Shield_V2", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\Ticker\\src", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\Wire", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\esp8266\\src", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\lwIP_Ethernet\\src", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\lwIP_PPP\\src", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\lwIP_enc28j60\\src", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\lwIP_w5100\\src", "C:\\Users\\applenana\\.platformio\\packages\\framework-arduinoespressif8266\\libraries\\lwIP_w5500\\src"], "toolchain": ["C:\\Users\\applenana\\.platformio\\packages\\toolchain-xtensa\\xtensa-lx106-elf\\include\\c++\\10.3.0", "C:\\Users\\applenana\\.platformio\\packages\\toolchain-xtensa\\xtensa-lx106-elf\\include\\c++\\10.3.0\\xtensa-lx106-elf", "C:\\Users\\applenana\\.platformio\\packages\\toolchain-xtensa\\lib\\gcc\\xtensa-lx106-elf\\10.3.0\\include", "C:\\Users\\applenana\\.platformio\\packages\\toolchain-xtensa\\lib\\gcc\\xtensa-lx106-elf\\10.3.0\\include-fixed", "C:\\Users\\applenana\\.platformio\\packages\\toolchain-xtensa\\xtensa-lx106-elf\\include"]}, "cc_flags": ["-std=gnu17", "-Wpointer-arith", "-Wno-implicit-function-declaration", "-Wl,-EL", "-fno-inline-functions", "-nostdlib", "-Os", "-mlongcalls", "-mtext-section-literals", "-falign-functions=4", "-U__STRICT_ANSI__", "-ffunction-sections", "-fdata-sections", "-Wall", "-Werror=return-type", "-free", "-fipa-pta"], "cxx_flags": ["-fno-rtti", "-std=gnu++17", "-fno-exceptions", "-Os", "-mlongcalls", "-mtext-section-literals", "-falign-functions=4", "-U__STRICT_ANSI__", "-ffunction-sections", "-fdata-sections", "-Wall", "-Werror=return-type", "-free", "-fipa-pta"], "cc_path": "C:\\Users\\applenana\\.platformio\\packages\\toolchain-xtensa\\bin\\xtensa-lx106-elf-gcc.exe", "cxx_path": "C:\\Users\\applenana\\.platformio\\packages\\toolchain-xtensa\\bin\\xtensa-lx106-elf-g++.exe", "gdb_path": "C:\\Users\\applenana\\.platformio\\packages\\toolchain-xtensa\\bin\\xtensa-lx106-elf-gdb.exe", "prog_path": "c:\\Users\\applenana\\Desktop\\ams\u9879\u76ee\\arduino\\FAMSL\\.pio\\build\\esp12e\\firmware.elf", "svd_path": null, "compiler_type": "gcc", "targets": [{"name": "buildfs", "title": "Build Filesystem Image", "description": null, "group": "Platform"}, {"name": "size", "title": "Program Size", "description": "Calculate program size", "group": "Platform"}, {"name": "upload", "title": "Upload", "description": null, "group": "Platform"}, {"name": "uploadfs", "title": "Upload Filesystem Image", "description": null, "group": "Platform"}, {"name": "uploadfsota", "title": "Upload Filesystem Image OTA", "description": null, "group": "Platform"}, {"name": "erase", "title": "Erase Flash", "description": null, "group": "Platform"}], "extra": {"flash_images": []}}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Arduino/.pio/build/esp12e/lib049/libLittleFS.a
Binary file not shown.
Binary file modified Arduino/.pio/build/esp12e/lib13e/libCRC.a
Binary file not shown.
Binary file modified Arduino/.pio/build/esp12e/lib975/libServo.a
Binary file not shown.
Binary file modified Arduino/.pio/build/esp12e/libFrameworkArduino.a
Binary file not shown.
Binary file modified Arduino/.pio/build/esp12e/libd70/libAdafruit NeoPixel.a
Binary file not shown.
Binary file added Arduino/.pio/build/esp12e/src/File.cpp.o
Binary file not shown.
Binary file modified Arduino/.pio/build/esp12e/src/main.cpp.o
Binary file not shown.
Binary file modified Arduino/.pio/build/esp12e/src/processData.cpp.o
Binary file not shown.
2 changes: 1 addition & 1 deletion Arduino/.pio/build/project.checksum
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c0be9ba1023ee6c7fb502a0a0bd9a322b56b65dc
aae944ca046edc15e5015c50ba39c6692d68710b
5 changes: 5 additions & 0 deletions Arduino/include/File.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#pragma once
#include <LittleFS.h>

void WriteByteIntoConfig(const byte* content, uint8_t contentLength);
void ReadContentFromConfig(byte* content, size_t length);
1 change: 1 addition & 0 deletions Arduino/include/processData.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
extern Motor mc;
extern ServoMotor sv;
extern String FilamentState;
extern bool Is5sPull;
void processData(DataPacket data);
13 changes: 13 additions & 0 deletions Arduino/src/File.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "File.h"

void WriteByteIntoConfig(const byte* content, uint8_t contentLength){
File file = LittleFS.open("/config.bin", "w");
file.write(content, contentLength);
file.close();
}

void ReadContentFromConfig(byte* content, size_t length){
File file = LittleFS.open("/config.bin", "r");
file.read(content, length);
file.close();
}
60 changes: 47 additions & 13 deletions Arduino/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "ServoMotor.h"
#include "Motor.h"
#include <Adafruit_NeoPixel.h>
#include <LittleFS.h>
#include "led.h"

DataPacket datapacket;
Expand All @@ -13,12 +14,15 @@ Adafruit_NeoPixel leds(3, 12, NEO_GRB + NEO_KHZ800);//构建leds对象(3个led,1
unsigned int FilamentIoPin = A0; //断料检测引脚(ADC=>A0)
String FilamentState = "none"; //断料状态
bool IsFPinHigh;//ADC是否高电平
bool Is5sPull = false;//是否使用5s退料模式
unsigned long LastBootPressTime;//上一次Boot按键被按下的时间

void FilamentChange(bool ToStateIsHigh);

void setup() {
Serial.begin(115200,SERIAL_8E1);
Serial1.begin(115200,SERIAL_8E1);
LittleFS.begin();
leds.begin();

IsFPinHigh = (analogRead(A0) > 1000);
Expand All @@ -35,6 +39,26 @@ void loop() {
IsFPinHigh = not IsFPinHigh;
}

if (digitalRead(0) == LOW){
while (digitalRead(0) == LOW){
delay(10);
//等待BOOT被松开
}
long nowTime = millis();
if ((nowTime - LastBootPressTime)<250){//如果0.25秒内按下两次BOOT则判定切换状态
//Serial.println("双击BOOT");
Is5sPull = not Is5sPull;
if (Is5sPull){
//Serial.println("5s回抽模式,白灯");
ledPC(2,255,255,255);
}else{
//Serial.println("微动回抽模式,没灯");
ledPC(2,0,0,0);
}
}
LastBootPressTime = nowTime;
}

if (datapacket.index == 0 and Serial.read() == 0x3D){
//Serial.println("帧头");
datapacket.index += 1;
Expand Down Expand Up @@ -116,21 +140,31 @@ void loop() {
}

void FilamentChange(bool ToStateIsHigh){
if (ToStateIsHigh){
//低变高-无变有
if (FilamentState == "none" or FilamentState == "inexist"){
if (Is5sPull){
if (ToStateIsHigh){
//低变高-无变有
FilamentState = "exist";
}else if (FilamentState == "busy"){
mc.stop();
sv.pull();
FilamentState = "exist";
}
}else if(not ToStateIsHigh){
//高变低-有变无
if (FilamentState == "none" or FilamentState == "exist"){
}else if(not ToStateIsHigh){
//高变低-有变无
FilamentState = "inexist";
}else if (FilamentState == "busy"){
mc.forward();
}
}else{
if (ToStateIsHigh){
//低变高-无变有
if (FilamentState == "none" or FilamentState == "inexist"){
FilamentState = "exist";
}else if (FilamentState == "busy"){
mc.stop();
sv.pull();
FilamentState = "exist";
}
}else if(not ToStateIsHigh){
//高变低-有变无
if (FilamentState == "none" or FilamentState == "exist"){
FilamentState = "inexist";
}else if (FilamentState == "busy"){
mc.forward();
}
}
}
}
20 changes: 19 additions & 1 deletion Arduino/src/processData.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "processData.h"
#include "File.h"

void processData(DataPacket data){
if (data.sequenceNumber >= data.address){
Expand Down Expand Up @@ -34,14 +35,31 @@ void processData(DataPacket data){
mc.stop();
FilamentState = "exist";
break;
case 0x03://抽回结束
if (Is5sPull){
delay(7000);//回抽七秒
sv.pull();
mc.stop();
FilamentState = "exist";
break;
}
}

data.length = 0x09;
data.commandType = 0x81;
data.content[0] = 0x00;
data.sendPacket(true);
//发送回应数据包

break;
case 0x02:
WriteByteIntoConfig(data.content,40);
//写入配置
break;
case 0x03:
ReadContentFromConfig(data.content,40);
//读取配置(更改内容为配置信息)
data.sendPacket(true);
//发送回应数据包
break;
}

Expand Down

0 comments on commit 5614d2d

Please sign in to comment.