├── .cproject ├── .gitattributes ├── .gitignore ├── .project ├── .settings ├── org.eclipse.cdt.codan.core.prefs ├── org.eclipse.cdt.core.prefs ├── org.eclipse.cdt.managedbuilder.core.prefs └── org.eclipse.core.resources.prefs ├── AddingNewKinematics.md ├── BuildInstructions.md ├── Developer-documentation └── New ESP8266 WiFi module code for Duet WiFi.odt ├── Driver ├── DuetDriverFiles.zip ├── README.md ├── duet.inf └── duetinf.cat ├── HTTP requests.md ├── JSON responses.md ├── LICENCE ├── LPC └── ExampleBoardConfig │ ├── board-AZSMZ-mini.txt │ ├── board-AzteegMini_v1.1.txt │ ├── board-BIQUSKR_v1.1.txt │ ├── board-BIQUSKR_v1.3.txt │ ├── board-BIQUSKR_v1.4.txt │ ├── board-Generic-LPC.txt │ ├── board-MKSSBase_v1.3.txt │ ├── board-ReArm_v1.0.txt │ └── board-smoothieboard.txt ├── Maths ├── BedLevelling-2-point.wxm ├── BedLevelling-3-point.wxm ├── BedLevelling-4-point.wxm ├── closestPointOfApproach2d.wxmx ├── closestPointOfApproach3d.wxmx ├── trilateration-triple.wxmx └── trilateration.wxmx ├── README.md ├── Scripts ├── duet3_openocd.cfg └── signdriver.bat ├── Tools ├── Windows │ ├── bossac.exe │ └── listComPorts.exe └── crc32appender │ ├── crc32appender.go │ ├── linux-x86_64 │ └── crc32appender │ ├── macos-x86_64 │ └── crc32appender │ └── win-x86_64 │ └── crc32appender.exe ├── WHATS_NEW.md ├── WHATS_NEW_LPC.md ├── WHATS_NEW_RRF3.md └── src ├── BugList.txt ├── CAN ├── CanInterface.cpp ├── CanInterface.h ├── CanMessageGenericConstructor.cpp ├── CanMessageGenericConstructor.h ├── CanMotion.cpp ├── CanMotion.h ├── CommandProcessor.cpp ├── CommandProcessor.h ├── ExpansionManager.cpp └── ExpansionManager.h ├── Configuration.h ├── Display ├── Display.cpp ├── Display.h ├── Menu.cpp ├── Menu.h ├── MenuItem.cpp ├── MenuItem.h ├── RotaryEncoder.cpp ├── RotaryEncoder.h └── ST7920 │ ├── glcd11x14.cpp │ ├── glcd7x11.cpp │ ├── lcd7920.cpp │ └── lcd7920.h ├── Duet3_V05 ├── Pins_Duet3_V05.cpp └── Pins_Duet3_V05.h ├── Duet3_V06 ├── Pins_Duet3_V06.cpp └── Pins_Duet3_V06.h ├── DuetM ├── Pins_DuetM.cpp └── Pins_DuetM.h ├── DuetNG ├── DueXn.cpp ├── DueXn.h ├── Pins_DuetNG.cpp ├── Pins_DuetNG.h ├── SX1509.cpp ├── SX1509.h └── SX1509Registers.h ├── Endstops ├── Endstop.cpp ├── Endstop.h ├── EndstopDefs.h ├── EndstopsManager.cpp ├── EndstopsManager.h ├── LocalZProbe.cpp ├── LocalZProbe.h ├── RemoteZProbe.cpp ├── RemoteZProbe.h ├── StallDetectionEndstop.cpp ├── StallDetectionEndstop.h ├── SwitchEndstop.cpp ├── SwitchEndstop.h ├── ZProbe.cpp ├── ZProbe.h ├── ZProbeEndstop.cpp └── ZProbeEndstop.h ├── Fans ├── DotStarLed.cpp ├── DotStarLed.h ├── Fan.cpp ├── Fan.h ├── FansManager.cpp ├── FansManager.h ├── LocalFan.cpp ├── LocalFan.h ├── RemoteFan.cpp └── RemoteFan.h ├── FilamentMonitors ├── Duet3DFilamentMonitor.cpp ├── Duet3DFilamentMonitor.h ├── FilamentMonitor.cpp ├── FilamentMonitor.h ├── LaserFilamentMonitor.cpp ├── LaserFilamentMonitor.h ├── PulsedFilamentMonitor.cpp ├── PulsedFilamentMonitor.h ├── RotatingMagnetFilamentMonitor.cpp ├── RotatingMagnetFilamentMonitor.h ├── SimpleFilamentMonitor.cpp └── SimpleFilamentMonitor.h ├── GCodes ├── GCodeBuffer │ ├── BinaryParser.cpp │ ├── BinaryParser.h │ ├── ExpressionParser.cpp │ ├── ExpressionParser.h │ ├── GCodeBuffer.cpp │ ├── GCodeBuffer.h │ ├── StringParser.cpp │ └── StringParser.h ├── GCodeChannel.h ├── GCodeException.cpp ├── GCodeException.h ├── GCodeFileInfo.cpp ├── GCodeFileInfo.h ├── GCodeInput.cpp ├── GCodeInput.h ├── GCodeMachineState.cpp ├── GCodeMachineState.h ├── GCodeQueue.cpp ├── GCodeQueue.h ├── GCodeResult.h ├── GCodes.cpp ├── GCodes.h ├── GCodes2.cpp ├── GCodes3.cpp ├── GCodes4.cpp ├── ObjectTracker.cpp ├── ObjectTracker.h ├── RestorePoint.cpp ├── RestorePoint.h ├── Trigger.cpp └── Trigger.h ├── GPIO ├── GpInPort.cpp ├── GpInPort.h ├── GpOutPort.cpp └── GpOutPort.h ├── Hardware ├── Cache.cpp ├── Cache.h ├── CanDriver.cpp ├── CanDriver.h ├── DmacManager.cpp ├── DmacManager.h ├── I2C.cpp ├── I2C.h ├── IoPorts.cpp └── IoPorts.h ├── Heating ├── FOPDT.cpp ├── FOPDT.h ├── Heat.cpp ├── Heat.h ├── Heater.cpp ├── Heater.h ├── HeaterMonitor.cpp ├── HeaterMonitor.h ├── LocalHeater.cpp ├── LocalHeater.h ├── RemoteHeater.cpp ├── RemoteHeater.h ├── Sensors │ ├── AdditionalOutputSensor.cpp │ ├── AdditionalOutputSensor.h │ ├── CpuTemperatureSensor.cpp │ ├── CpuTemperatureSensor.h │ ├── CurrentLoopTemperatureSensor.cpp │ ├── CurrentLoopTemperatureSensor.h │ ├── DhtSensor.cpp │ ├── DhtSensor.h │ ├── LinearAnalogSensor.cpp │ ├── LinearAnalogSensor.h │ ├── RemoteSensor.cpp │ ├── RemoteSensor.h │ ├── RtdSensor31865.cpp │ ├── RtdSensor31865.h │ ├── SensorWithPort.cpp │ ├── SensorWithPort.h │ ├── SpiTemperatureSensor.cpp │ ├── SpiTemperatureSensor.h │ ├── TemperatureSensor.cpp │ ├── TemperatureSensor.h │ ├── Thermistor.cpp │ ├── Thermistor.h │ ├── ThermocoupleSensor31855.cpp │ ├── ThermocoupleSensor31855.h │ ├── ThermocoupleSensor31856.cpp │ ├── ThermocoupleSensor31856.h │ ├── TmcDriverTemperatureSensor.cpp │ └── TmcDriverTemperatureSensor.h ├── TemperatureError.cpp └── TemperatureError.h ├── LPC ├── BoardConfig.cpp ├── BoardConfig.h ├── Boards │ ├── AzsmzMini.h │ ├── AzteegX5Mini.h │ ├── BIQU_SKR.h │ ├── Generic.h │ ├── MKSSBase.h │ ├── Mbed.h │ ├── ReArm.h │ └── Smoothieboard.h ├── FatFS │ ├── diskio.cpp │ ├── diskio.h │ ├── fattime_rtc.cpp │ ├── ff.c │ ├── ff.h │ ├── ffconf.h │ ├── ffunicode.c │ └── integer.h ├── FirmwareUpdate.hpp ├── LPCNetworking │ ├── ESP8266WiFi │ │ └── WiFiInterface_LPC.hpp │ └── RTOSPlusTCPEthernet │ │ ├── RTOSPlusTCPEthernetInterface.cpp │ │ ├── RTOSPlusTCPEthernetInterface.h │ │ ├── RTOSPlusTCPEthernetServerSocket.cpp │ │ ├── RTOSPlusTCPEthernetServerSocket.h │ │ ├── RTOSPlusTCPEthernetSocket.cpp │ │ └── RTOSPlusTCPEthernetSocket.h ├── Linux │ └── DataTransfer_LPC.hpp ├── MCP4461 │ ├── MCP4461.cpp │ └── MCP4461.h ├── Microstepping.cpp ├── Microstepping.h ├── NoNetwork │ ├── Network.cpp │ └── Network.h ├── Pins_LPC.cpp ├── Pins_LPC.h ├── SoftwareResetData.cpp └── SoftwareResetData.h ├── Libraries ├── .gitignore ├── Fatfs │ ├── diskio.cpp │ ├── diskio.h │ ├── fattime_rtc.cpp │ ├── ff.c │ ├── ff.h │ ├── ffconf.h │ ├── ffunicode.c │ └── integer.h └── sha1 │ ├── sha1.c │ └── sha1.h ├── Linux ├── DataTransfer.cpp ├── DataTransfer.h ├── LinuxInterface.cpp ├── LinuxInterface.h └── LinuxMessageFormats.h ├── Logger.cpp ├── Logger.h ├── Memory usage.ods ├── MessageType.h ├── Movement ├── BedProbing │ ├── Grid.cpp │ ├── Grid.h │ ├── RandomProbePointSet.cpp │ └── RandomProbePointSet.h ├── DDA.cpp ├── DDA.h ├── DDARing.cpp ├── DDARing.h ├── DriveMovement.cpp ├── DriveMovement.h ├── HeightControl │ ├── HeightController.cpp │ └── HeightController.h ├── Kinematics │ ├── CoreKinematics.cpp │ ├── CoreKinematics.h │ ├── FiveBarScaraKinematics.cpp │ ├── FiveBarScaraKinematics.h │ ├── HangprinterKinematics.cpp │ ├── HangprinterKinematics.h │ ├── Kinematics.cpp │ ├── Kinematics.h │ ├── LinearDeltaKinematics.cpp │ ├── LinearDeltaKinematics.h │ ├── PolarKinematics.cpp │ ├── PolarKinematics.h │ ├── RotaryDeltaKinematics.cpp │ ├── RotaryDeltaKinematics.h │ ├── ScaraKinematics.cpp │ ├── ScaraKinematics.h │ ├── ZLeadscrewKinematics.cpp │ └── ZLeadscrewKinematics.h ├── Move.cpp ├── Move.h ├── RawMove.cpp ├── RawMove.h ├── StepTimer.cpp ├── StepTimer.h ├── StepperDrivers │ ├── DriverMode.cpp │ ├── DriverMode.h │ ├── TMC22xx.cpp │ ├── TMC22xx.h │ ├── TMC2660.cpp │ ├── TMC2660.h │ ├── TMC51xx.cpp │ └── TMC51xx.h ├── StraightProbeSettings.cpp └── StraightProbeSettings.h ├── Networking ├── ESP8266WiFi │ ├── WiFiInterface.cpp │ ├── WiFiInterface.h │ ├── WiFiSocket.cpp │ ├── WiFiSocket.h │ ├── WifiFirmwareUploader.cpp │ └── WifiFirmwareUploader.h ├── FirmwareUpdater.cpp ├── FirmwareUpdater.h ├── FtpResponder.cpp ├── FtpResponder.h ├── HttpResponder.cpp ├── HttpResponder.h ├── LwipEthernet │ ├── GMAC │ │ ├── ethernet_sam.cpp │ │ ├── ethernet_sam.h │ │ ├── same70_gmac.cpp │ │ └── same70_gmac.h │ ├── Lwip │ │ ├── CHANGELOG │ │ ├── CMakeLists.txt │ │ ├── COPYING │ │ ├── FEATURES │ │ ├── FILES │ │ ├── README │ │ ├── UPGRADING │ │ ├── doc │ │ │ ├── FILES │ │ │ ├── NO_SYS_SampleCode.c │ │ │ ├── ZeroCopyRx.c │ │ │ ├── contrib.txt │ │ │ ├── mdns.txt │ │ │ ├── mqtt_client.txt │ │ │ ├── ppp.txt │ │ │ └── savannah.txt │ │ ├── lwipopts.h │ │ └── src │ │ │ ├── FILES │ │ │ ├── Filelists.cmake │ │ │ ├── Filelists.mk │ │ │ ├── api │ │ │ ├── api_lib.c │ │ │ ├── api_msg.c │ │ │ ├── err.c │ │ │ ├── if_api.c │ │ │ ├── netbuf.c │ │ │ ├── netdb.c │ │ │ ├── netifapi.c │ │ │ ├── sockets.c │ │ │ └── tcpip.c │ │ │ ├── apps │ │ │ ├── altcp_tls │ │ │ │ ├── altcp_tls_mbedtls.c │ │ │ │ ├── altcp_tls_mbedtls_mem.c │ │ │ │ ├── altcp_tls_mbedtls_mem.h │ │ │ │ └── altcp_tls_mbedtls_structs.h │ │ │ ├── http │ │ │ │ ├── altcp_proxyconnect.c │ │ │ │ ├── fs.c │ │ │ │ ├── fs │ │ │ │ │ ├── 404.html │ │ │ │ │ ├── img │ │ │ │ │ │ └── sics.gif │ │ │ │ │ └── index.html │ │ │ │ ├── fsdata.c │ │ │ │ ├── fsdata.h │ │ │ │ ├── http_client.c │ │ │ │ ├── httpd.c │ │ │ │ ├── httpd_structs.h │ │ │ │ └── makefsdata │ │ │ │ │ ├── makefsdata │ │ │ │ │ ├── makefsdata.c │ │ │ │ │ ├── readme.txt │ │ │ │ │ └── tinydir.h │ │ │ ├── lwiperf │ │ │ │ └── lwiperf.c │ │ │ ├── mdns │ │ │ │ └── mdns.c │ │ │ ├── mqtt │ │ │ │ └── mqtt.c │ │ │ ├── netbiosns │ │ │ │ └── netbiosns.c │ │ │ ├── smtp │ │ │ │ └── smtp.c │ │ │ ├── snmp │ │ │ │ ├── snmp_asn1.c │ │ │ │ ├── snmp_asn1.h │ │ │ │ ├── snmp_core.c │ │ │ │ ├── snmp_core_priv.h │ │ │ │ ├── snmp_mib2.c │ │ │ │ ├── snmp_mib2_icmp.c │ │ │ │ ├── snmp_mib2_interfaces.c │ │ │ │ ├── snmp_mib2_ip.c │ │ │ │ ├── snmp_mib2_snmp.c │ │ │ │ ├── snmp_mib2_system.c │ │ │ │ ├── snmp_mib2_tcp.c │ │ │ │ ├── snmp_mib2_udp.c │ │ │ │ ├── snmp_msg.c │ │ │ │ ├── snmp_msg.h │ │ │ │ ├── snmp_netconn.c │ │ │ │ ├── snmp_pbuf_stream.c │ │ │ │ ├── snmp_pbuf_stream.h │ │ │ │ ├── snmp_raw.c │ │ │ │ ├── snmp_scalar.c │ │ │ │ ├── snmp_snmpv2_framework.c │ │ │ │ ├── snmp_snmpv2_usm.c │ │ │ │ ├── snmp_table.c │ │ │ │ ├── snmp_threadsync.c │ │ │ │ ├── snmp_traps.c │ │ │ │ ├── snmpv3.c │ │ │ │ ├── snmpv3_mbedtls.c │ │ │ │ └── snmpv3_priv.h │ │ │ ├── sntp │ │ │ │ └── sntp.c │ │ │ └── tftp │ │ │ │ └── tftp_server.c │ │ │ ├── core │ │ │ ├── altcp.c │ │ │ ├── altcp_alloc.c │ │ │ ├── altcp_tcp.c │ │ │ ├── def.c │ │ │ ├── dns.c │ │ │ ├── inet_chksum.c │ │ │ ├── init.c │ │ │ ├── ip.c │ │ │ ├── ipv4 │ │ │ │ ├── autoip.c │ │ │ │ ├── dhcp.c │ │ │ │ ├── etharp.c │ │ │ │ ├── icmp.c │ │ │ │ ├── igmp.c │ │ │ │ ├── ip4.c │ │ │ │ ├── ip4_addr.c │ │ │ │ └── ip4_frag.c │ │ │ ├── ipv6 │ │ │ │ ├── dhcp6.c │ │ │ │ ├── ethip6.c │ │ │ │ ├── icmp6.c │ │ │ │ ├── inet6.c │ │ │ │ ├── ip6.c │ │ │ │ ├── ip6_addr.c │ │ │ │ ├── ip6_frag.c │ │ │ │ ├── mld6.c │ │ │ │ └── nd6.c │ │ │ ├── mem.c │ │ │ ├── memp.c │ │ │ ├── netif.c │ │ │ ├── pbuf.c │ │ │ ├── raw.c │ │ │ ├── stats.c │ │ │ ├── sys.c │ │ │ ├── tcp.c │ │ │ ├── tcp_in.c │ │ │ ├── tcp_out.c │ │ │ ├── timeouts.c │ │ │ └── udp.c │ │ │ ├── include │ │ │ ├── arch │ │ │ │ ├── cc.h │ │ │ │ ├── perf.h │ │ │ │ └── sys_arch.h │ │ │ ├── compat │ │ │ │ ├── posix │ │ │ │ │ ├── arpa │ │ │ │ │ │ └── inet.h │ │ │ │ │ ├── net │ │ │ │ │ │ └── if.h │ │ │ │ │ ├── netdb.h │ │ │ │ │ └── sys │ │ │ │ │ │ └── socket.h │ │ │ │ └── stdc │ │ │ │ │ └── errno.h │ │ │ ├── lwip │ │ │ │ ├── altcp.h │ │ │ │ ├── altcp_tcp.h │ │ │ │ ├── altcp_tls.h │ │ │ │ ├── api.h │ │ │ │ ├── apps │ │ │ │ │ ├── FILES │ │ │ │ │ ├── altcp_proxyconnect.h │ │ │ │ │ ├── altcp_tls_mbedtls_opts.h │ │ │ │ │ ├── fs.h │ │ │ │ │ ├── http_client.h │ │ │ │ │ ├── httpd.h │ │ │ │ │ ├── httpd_opts.h │ │ │ │ │ ├── lwiperf.h │ │ │ │ │ ├── mdns.h │ │ │ │ │ ├── mdns_opts.h │ │ │ │ │ ├── mdns_priv.h │ │ │ │ │ ├── mqtt.h │ │ │ │ │ ├── mqtt_opts.h │ │ │ │ │ ├── mqtt_priv.h │ │ │ │ │ ├── netbiosns.h │ │ │ │ │ ├── netbiosns_opts.h │ │ │ │ │ ├── smtp.h │ │ │ │ │ ├── smtp_opts.h │ │ │ │ │ ├── snmp.h │ │ │ │ │ ├── snmp_core.h │ │ │ │ │ ├── snmp_mib2.h │ │ │ │ │ ├── snmp_opts.h │ │ │ │ │ ├── snmp_scalar.h │ │ │ │ │ ├── snmp_snmpv2_framework.h │ │ │ │ │ ├── snmp_snmpv2_usm.h │ │ │ │ │ ├── snmp_table.h │ │ │ │ │ ├── snmp_threadsync.h │ │ │ │ │ ├── snmpv3.h │ │ │ │ │ ├── sntp.h │ │ │ │ │ ├── sntp_opts.h │ │ │ │ │ ├── tftp_opts.h │ │ │ │ │ └── tftp_server.h │ │ │ │ ├── arch.h │ │ │ │ ├── autoip.h │ │ │ │ ├── debug.h │ │ │ │ ├── def.h │ │ │ │ ├── dhcp.h │ │ │ │ ├── dhcp6.h │ │ │ │ ├── dns.h │ │ │ │ ├── err.h │ │ │ │ ├── errno.h │ │ │ │ ├── etharp.h │ │ │ │ ├── ethip6.h │ │ │ │ ├── icmp.h │ │ │ │ ├── icmp6.h │ │ │ │ ├── if_api.h │ │ │ │ ├── igmp.h │ │ │ │ ├── inet.h │ │ │ │ ├── inet_chksum.h │ │ │ │ ├── init.h │ │ │ │ ├── init.h.cmake.in │ │ │ │ ├── ip.h │ │ │ │ ├── ip4.h │ │ │ │ ├── ip4_addr.h │ │ │ │ ├── ip4_frag.h │ │ │ │ ├── ip6.h │ │ │ │ ├── ip6_addr.h │ │ │ │ ├── ip6_frag.h │ │ │ │ ├── ip6_zone.h │ │ │ │ ├── ip_addr.h │ │ │ │ ├── mem.h │ │ │ │ ├── memp.h │ │ │ │ ├── mld6.h │ │ │ │ ├── nd6.h │ │ │ │ ├── netbuf.h │ │ │ │ ├── netdb.h │ │ │ │ ├── netif.h │ │ │ │ ├── netifapi.h │ │ │ │ ├── opt.h │ │ │ │ ├── pbuf.h │ │ │ │ ├── priv │ │ │ │ │ ├── altcp_priv.h │ │ │ │ │ ├── api_msg.h │ │ │ │ │ ├── mem_priv.h │ │ │ │ │ ├── memp_priv.h │ │ │ │ │ ├── memp_std.h │ │ │ │ │ ├── nd6_priv.h │ │ │ │ │ ├── raw_priv.h │ │ │ │ │ ├── sockets_priv.h │ │ │ │ │ ├── tcp_priv.h │ │ │ │ │ └── tcpip_priv.h │ │ │ │ ├── prot │ │ │ │ │ ├── autoip.h │ │ │ │ │ ├── dhcp.h │ │ │ │ │ ├── dhcp6.h │ │ │ │ │ ├── dns.h │ │ │ │ │ ├── etharp.h │ │ │ │ │ ├── ethernet.h │ │ │ │ │ ├── iana.h │ │ │ │ │ ├── icmp.h │ │ │ │ │ ├── icmp6.h │ │ │ │ │ ├── ieee.h │ │ │ │ │ ├── igmp.h │ │ │ │ │ ├── ip.h │ │ │ │ │ ├── ip4.h │ │ │ │ │ ├── ip6.h │ │ │ │ │ ├── mld6.h │ │ │ │ │ ├── nd6.h │ │ │ │ │ ├── tcp.h │ │ │ │ │ └── udp.h │ │ │ │ ├── raw.h │ │ │ │ ├── sio.h │ │ │ │ ├── snmp.h │ │ │ │ ├── sockets.h │ │ │ │ ├── stats.h │ │ │ │ ├── sys.h │ │ │ │ ├── sys.h.keep │ │ │ │ ├── tcp.h │ │ │ │ ├── tcpbase.h │ │ │ │ ├── tcpip.h │ │ │ │ ├── timeouts.h │ │ │ │ └── udp.h │ │ │ └── netif │ │ │ │ ├── bridgeif.h │ │ │ │ ├── bridgeif_opts.h │ │ │ │ ├── etharp.h │ │ │ │ ├── ethernet.h │ │ │ │ ├── ieee802154.h │ │ │ │ ├── lowpan6.h │ │ │ │ ├── lowpan6_ble.h │ │ │ │ ├── lowpan6_common.h │ │ │ │ ├── lowpan6_opts.h │ │ │ │ ├── ppp │ │ │ │ ├── ccp.h │ │ │ │ ├── chap-md5.h │ │ │ │ ├── chap-new.h │ │ │ │ ├── chap_ms.h │ │ │ │ ├── eap.h │ │ │ │ ├── ecp.h │ │ │ │ ├── eui64.h │ │ │ │ ├── fsm.h │ │ │ │ ├── ipcp.h │ │ │ │ ├── ipv6cp.h │ │ │ │ ├── lcp.h │ │ │ │ ├── magic.h │ │ │ │ ├── mppe.h │ │ │ │ ├── polarssl │ │ │ │ │ ├── arc4.h │ │ │ │ │ ├── des.h │ │ │ │ │ ├── md4.h │ │ │ │ │ ├── md5.h │ │ │ │ │ └── sha1.h │ │ │ │ ├── ppp.h │ │ │ │ ├── ppp_impl.h │ │ │ │ ├── ppp_opts.h │ │ │ │ ├── pppapi.h │ │ │ │ ├── pppcrypt.h │ │ │ │ ├── pppdebug.h │ │ │ │ ├── pppoe.h │ │ │ │ ├── pppol2tp.h │ │ │ │ ├── pppos.h │ │ │ │ ├── upap.h │ │ │ │ └── vj.h │ │ │ │ ├── slipif.h │ │ │ │ └── zepif.h │ │ │ └── netif │ │ │ ├── FILES │ │ │ ├── bridgeif.c │ │ │ ├── bridgeif_fdb.c │ │ │ ├── ethernet.c │ │ │ ├── lowpan6.c │ │ │ ├── lowpan6_ble.c │ │ │ ├── lowpan6_common.c │ │ │ ├── ppp │ │ │ ├── PPPD_FOLLOWUP │ │ │ ├── auth.c │ │ │ ├── ccp.c │ │ │ ├── chap-md5.c │ │ │ ├── chap-new.c │ │ │ ├── chap_ms.c │ │ │ ├── demand.c │ │ │ ├── eap.c │ │ │ ├── ecp.c │ │ │ ├── eui64.c │ │ │ ├── fsm.c │ │ │ ├── ipcp.c │ │ │ ├── ipv6cp.c │ │ │ ├── lcp.c │ │ │ ├── magic.c │ │ │ ├── mppe.c │ │ │ ├── multilink.c │ │ │ ├── polarssl │ │ │ │ ├── README │ │ │ │ ├── arc4.c │ │ │ │ ├── des.c │ │ │ │ ├── md4.c │ │ │ │ ├── md5.c │ │ │ │ └── sha1.c │ │ │ ├── ppp.c │ │ │ ├── pppapi.c │ │ │ ├── pppcrypt.c │ │ │ ├── pppoe.c │ │ │ ├── pppol2tp.c │ │ │ ├── pppos.c │ │ │ ├── upap.c │ │ │ ├── utils.c │ │ │ └── vj.c │ │ │ ├── slipif.c │ │ │ └── zepif.c │ ├── LwipEthernetInterface.cpp │ ├── LwipEthernetInterface.h │ ├── LwipSocket.cpp │ └── LwipSocket.h ├── Network.cpp ├── Network.h ├── NetworkBuffer.cpp ├── NetworkBuffer.h ├── NetworkDefs.h ├── NetworkInterface.cpp ├── NetworkInterface.h ├── NetworkResponder.cpp ├── NetworkResponder.h ├── Socket.h ├── TelnetResponder.cpp ├── TelnetResponder.h ├── UploadingNetworkResponder.cpp ├── UploadingNetworkResponder.h └── W5500Ethernet │ ├── MdnsResponder.cpp │ ├── MdnsResponder.h │ ├── W5500Interface.cpp │ ├── W5500Interface.h │ ├── W5500Socket.cpp │ ├── W5500Socket.h │ └── Wiznet │ ├── .gitattributes │ ├── .gitignore │ ├── Ethernet │ ├── Socket_APIs_V3.0.3.chm │ ├── W5500 │ │ ├── w5500.cpp │ │ └── w5500.h │ ├── WizSpi.cpp │ ├── WizSpi.h │ ├── socketlib.cpp │ ├── socketlib.h │ ├── wizchip_conf.cpp │ └── wizchip_conf.h │ ├── Internet │ └── DHCP │ │ ├── dhcp.cpp │ │ └── dhcp.h │ └── README.md ├── ObjectModel ├── ObjectModel.cpp └── ObjectModel.h ├── OutputMemory.cpp ├── OutputMemory.h ├── Pccb ├── Network.cpp ├── Network.h ├── Pins_Pccb.cpp └── Pins_Pccb.h ├── Pins.h ├── Platform.cpp ├── Platform.h ├── PortControl.cpp ├── PortControl.h ├── PrintMonitor.cpp ├── PrintMonitor.h ├── RADDS ├── Network.cpp ├── Network.h ├── Pins_RADDS.cpp └── Pins_RADDS.h ├── RTOS work pending.txt ├── RepRap.cpp ├── RepRap.h ├── RepRapFirmware.cpp ├── RepRapFirmware.h ├── RepRapFirmware.pdp ├── Roland.cpp ├── Roland.h ├── SAME70xpld ├── Pins_SAME70xpld.cpp └── Pins_SAME70xpld.h ├── Scanner.cpp ├── Scanner.h ├── SoftwareReset.cpp ├── SoftwareReset.h ├── Storage ├── CRC32.cpp ├── CRC32.h ├── FileData.h ├── FileInfoParser.cpp ├── FileInfoParser.h ├── FileStore.cpp ├── FileStore.h ├── FileWriteBuffer.h ├── MassStorage.cpp └── MassStorage.h ├── TaskPriorities.h ├── Tasks.cpp ├── Tasks.h ├── Tools ├── Filament.cpp ├── Filament.h ├── Spindle.cpp ├── Spindle.h ├── Tool.cpp └── Tool.h ├── Version.h ├── libc ├── local.h ├── memcmp.c ├── memcpy.c ├── memmove.c ├── memset.c ├── nano-mallocr.c ├── readme-libc.txt └── strptime.cpp └── libcpp ├── eh_alloc.cpp ├── readme-libcpp.txt ├── unwind-cxx.h └── vterminate.cc /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | *.inf binary -text 4 | 5 | # Custom for Visual Studio 6 | *.cs diff=csharp 7 | *.sln merge=union 8 | *.csproj merge=union 9 | *.vbproj merge=union 10 | *.fsproj merge=union 11 | *.dbproj merge=union 12 | 13 | # Standard to msysgit 14 | *.doc diff=astextplain 15 | *.DOC diff=astextplain 16 | *.docx diff=astextplain 17 | *.DOCX diff=astextplain 18 | *.dot diff=astextplain 19 | *.DOT diff=astextplain 20 | *.pdf diff=astextplain 21 | *.PDF diff=astextplain 22 | *.rtf diff=astextplain 23 | *.RTF diff=astextplain 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /Duet2_RTOS/ 2 | /Duet3_V05/ 3 | /Duet3_V06/ 4 | /Duet3_V06_CAN0/ 5 | /Duet3_V06_Debug/ 6 | /DuetM_RTOS/ 7 | /PCCB_08/ 8 | /PCCB_08_X5/ 9 | /PCCB_10/ 10 | /RADDS_RTOS/ 11 | /SAME70XPLD/ 12 | /.settings/language.settings.xml 13 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | RepRapFirmware 4 | 5 | 6 | CoreNG 7 | FreeRTOS 8 | RRFLibraries 9 | CANlib 10 | 11 | 12 | 13 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 14 | clean,full,incremental, 15 | 16 | 17 | 18 | 19 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 20 | full,incremental, 21 | 22 | 23 | 24 | 25 | 26 | org.eclipse.cdt.core.cnature 27 | org.eclipse.cdt.core.ccnature 28 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 29 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 30 | 31 | 32 | -------------------------------------------------------------------------------- /.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/Display/ST7920/glcd11x14.cpp=UTF-8 3 | encoding//src/Display/ST7920/glcd7x11.cpp=UTF-8 4 | encoding//src/Movement/StepperDrivers/TMC51xx.cpp=UTF-8 5 | -------------------------------------------------------------------------------- /AddingNewKinematics.md: -------------------------------------------------------------------------------- 1 | How to add support for additional kinematics to RepRapFirmware 2 | ============================================================== 3 | 4 | The supported kinematics are defined in files in folder src/Movement/Kinematics. It is organised as a class hierarchy. Each supported kinematics has its own class definition. For example, class CartesianKinematics supports standard Cartesian motion kinematics. The class declaration is in file CartesianKinematics.h and the implementation is in class CartesianKinematics.cpp. 5 | 6 | To add new kinematics: 7 | 1. Tell me the name of your kinematics and ask me (dc42) to allocate a kinematics type number for it, via the Duet3d forum. The kinematics type number will be the K parameter in the M669 command. 8 | 9 | 2. Create .h and .cpp files to declare and implement the class for your kinematics. If your machine has a conventional Z axis with one or more motors that only affect the Z coordinate, and you want to support bed levelling using multiple independent leadscrews, or the facility to assist users in determining corrections to make to manual bed levelling screws, then you should derive your kinematics class from class ZLeadscrewKinematics. Otherwise it is normally appropriate to derive it directly from class Kinematics. 10 | 11 | 3. In your kinematics class, override virtual functions as needed. See the comments in file Kinematics.h for a description of those functions. 12 | 13 | 4. Modify file Kinematics.cpp by adding a #include directive to include the .h file that declares your new kinematics. Also modify function Create by adding a new case to create an instance of your new kinematics class when the appropriate kinematics type number is passed. 14 | 15 | DC updated 2018-05-04. 16 | -------------------------------------------------------------------------------- /Developer-documentation/New ESP8266 WiFi module code for Duet WiFi.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdavi/RepRapFirmware/374100d1498cf62eab9f571e048a7358b575f994/Developer-documentation/New ESP8266 WiFi module code for Duet WiFi.odt -------------------------------------------------------------------------------- /Driver/DuetDriverFiles.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdavi/RepRapFirmware/374100d1498cf62eab9f571e048a7358b575f994/Driver/DuetDriverFiles.zip -------------------------------------------------------------------------------- /Driver/README.md: -------------------------------------------------------------------------------- 1 | These are the Windows device driver files for Duet electronics running RepRapFirmware 1.12 and later. 2 | 3 | Due to the difficulties of downloading text files from github without the line endings getting changed (which messes up the digital signature), I recommend you download the Zip file and extract the contents to a folder on your PC. 4 | -------------------------------------------------------------------------------- /Driver/duetinf.cat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdavi/RepRapFirmware/374100d1498cf62eab9f571e048a7358b575f994/Driver/duetinf.cat -------------------------------------------------------------------------------- /LPC/ExampleBoardConfig/board-AZSMZ-mini.txt: -------------------------------------------------------------------------------- 1 | //Config file to define Hardware Pins LPC Boards. 2 | //Note: Each line should be less than 120 characters. 3 | // : Unwanted options can be commented out or set to NoPin. Lines commented out will get default values 4 | // : for pins the default is NoPin. 5 | // : Values for Arrays need to be contained within { and } 6 | // : Comments can be defined with // or # (comments are not supported inside arrays) 7 | // : Each config entry must be all on a single line. 8 | 9 | // Original Config settings by RepRap User AlexY 10 | // LCD config by RepRap User Dot_Bob 11 | 12 | lpc.board = azsmzmini 13 | 14 | 15 | //LED blinks to indicate Platform is spinning or other diagnostic 16 | //Comment out or set to NoPin if not wanted. 17 | leds.diagnostic = 1.18; //RRF Diagnostics Pin (LED1) 18 | 19 | 20 | // Bed E0 21 | heat.tempSensePins = {0.25, 0.23}; //Max of 3 entries 22 | 23 | 24 | //**SPI Devices** 25 | 26 | // spiChannel 27 | // 0 SSP0 28 | // 1 SSP1 29 | // 2 SoftwareSPI (requires pins to be configured) 30 | 31 | 32 | //Only supports 1 External SDCard 33 | sdCard.external.csPin = 0.16; 34 | sdCard.external.cardDetectPin = 3.25; 35 | sdCard.external.spiFrequencyHz = 4000000; 36 | 37 | 38 | //LCD Pins (only ST9720 SPI currently supported) 39 | lcd.lcdCSPin = 1.22; //LCD Chip Select 40 | lcd.lcdBeepPin = 1.30; 41 | lcd.encoderPinA = 4.28; 42 | lcd.encoderPinB = 1.27; 43 | lcd.encoderPinSw = 3.26; //click 44 | lcd.lcdDCPin = 2.6; //DataControl Pin (A0) if none used set to NoPin 45 | lcd.panelButtonPin = NoPin; //Extra button RRD Panels 46 | 47 | -------------------------------------------------------------------------------- /LPC/ExampleBoardConfig/board-AzteegMini_v1.1.txt: -------------------------------------------------------------------------------- 1 | //Config file to define Hardware Pins LPC Boards. 2 | //Note: Each line should be less than 120 characters. 3 | // : Unwanted options can be commented out or set to NoPin. Lines commented out will get default values 4 | // : for pins the default is NoPin. 5 | // : Values for Arrays need to be contained within { and } 6 | // : Comments can be defined with // or # (comments are not supported inside arrays) 7 | // : Each config entry must be all on a single line. 8 | 9 | 10 | lpc.board = azteegx5mini_1.1 11 | 12 | 13 | // AzteegX5 Mini Leds: 14 | //Led1 - 1.18; 15 | //Led2 - 1.19; 16 | //Led3 - 1.20; 17 | //Led4 - 1.21; 18 | //Play - 4.28 19 | 20 | 21 | //LED blinks to indicate Platform is spinning or other diagnostic 22 | //Comment out or set to NoPin if not wanted. 23 | leds.diagnostic = 4.28; //RRF Diagnostics Pin (PlayLED) 24 | 25 | 26 | 27 | heat.tempSensePins = {0.23, 0.24}; //Max of 4 entries 28 | 29 | 30 | //**SPI Devices** 31 | 32 | //Only supports 1 External SDCard 33 | sdCard.external.csPin = 1.23; 34 | sdCard.external.cardDetectPin = 1.31; 35 | sdCard.external.spiFrequencyHz = 4000000; 36 | 37 | 38 | 39 | //LCD Pins (only ST9720 SPI currently supported) 40 | lcd.lcdCSPin = 0.16; //LCD Chip Select 41 | lcd.lcdBeepPin = 0.25; 42 | lcd.encoderPinA = 3.25; 43 | lcd.encoderPinB = 3.26; 44 | lcd.encoderPinSw = 2.11; //click 45 | lcd.lcdDCPin = 2.6; //DataControl Pin (A0) if none used set to NoPin 46 | lcd.panelButtonPin = 1.22; //Extra button on RRD Panels 47 | -------------------------------------------------------------------------------- /LPC/ExampleBoardConfig/board-BIQUSKR_v1.1.txt: -------------------------------------------------------------------------------- 1 | //Config file to define Hardware Pins LPC Boards. 2 | //Note: Each line should be less than 120 characters. 3 | // : Unwanted options can be commented out or set to NoPin. Lines commented out will get default values 4 | // : for pins the default is NoPin. 5 | // : Values for Arrays need to be contained within { and } 6 | // : Comments can be defined with // or # (comments are not supported inside arrays) 7 | // : Each config entry must be all on a single line. 8 | 9 | //Config for BIQU SKR v1.1 (using config setting from Rob Mendon) 10 | 11 | lpc.board = biquskr_1.1 12 | 13 | 14 | 15 | //LED blinks to indicate Platform is spinning or other diagnostic 16 | //Comment out or set to NoPin if not wanted. 17 | leds.diagnostic = NoPin; //RRF Diagnostics Pin 18 | 19 | 20 | // Bed E0 E1 21 | heat.tempSensePins = {0.23, 0.24, 0.25}; //Max of 4 entries 22 | heat.spiTempSensorCSPins = { } 23 | 24 | 25 | 26 | //**SPI Devices** 27 | 28 | // spiChannel 29 | // 0 SSP0 30 | // 1 SSP1 31 | // 2 SoftwareSPI (requires pins to be configured) 32 | 33 | 34 | 35 | //Only supports 1 External SDCard 36 | sdCard.external.csPin = 1.23; 37 | sdCard.external.cardDetectPin = 1.31; 38 | sdCard.external.spiFrequencyHz = 4000000; 39 | 40 | 41 | //LCD Pins (only ST9720 SPI currently supported) 42 | lcd.lcdCSPin = 0.16; //LCD Chip Select 43 | lcd.lcdBeepPin = 1.30; 44 | lcd.encoderPinA = 3.26; 45 | lcd.encoderPinB = 3.25; 46 | lcd.encoderPinSw = 2.11; //click 47 | lcd.lcdDCPin = 0.18; //DataControl Pin (A0) if none used set to NoPin 48 | lcd.panelButtonPin = NoPin; //Extra button on RRD Panels 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /LPC/ExampleBoardConfig/board-BIQUSKR_v1.3.txt: -------------------------------------------------------------------------------- 1 | //Config file to define Hardware Pins LPC Boards. 2 | //Note: Each line should be less than 120 characters. 3 | // : Unwanted options can be commented out or set to NoPin. Lines commented out will get default values 4 | // : for pins the default is NoPin. 5 | // : Values for Arrays need to be contained within { and } 6 | // : Comments can be defined with // or # (comments are not supported inside arrays) 7 | // : Each config entry must be all on a single line. 8 | 9 | lpc.board = biquskr_1.3 10 | 11 | // Bed E0 E1 12 | heat.tempSensePins = {0.23, 0.24, 0.25}; //tb, th0, th1 13 | 14 | //**SPI Devices** 15 | 16 | // spiChannel 17 | // 0 SSP0 18 | // 1 SSP1 19 | // 2 SoftwareSPI (requires pins to be configured) 20 | 21 | 22 | //Only supports 1 External SDCard 23 | sdCard.external.csPin = 0.16; 24 | sdCard.external.cardDetectPin = 1.31; 25 | sdCard.external.spiFrequencyHz = 4000000; 26 | sdCard.external.spiChannel = 0; 27 | 28 | 29 | 30 | //LCD Pins (only ST9720 SPI currently supported) 31 | 32 | //setup the Software SPI Pins for LCD 33 | softwareSPI.pins = {1.20, NoPin, 1.18}; //Set to GPIO pins to use as SCK, MISO, MOSI 34 | 35 | lcd.spiChannel = 2; //2 = SWSPI - Use Software SPI Channel 36 | lcd.lcdCSPin = 1.19; //LCD Chip Select 37 | lcd.lcdBeepPin = 1.30; 38 | lcd.encoderPinA = 3.26; 39 | lcd.encoderPinB = 3.25; 40 | lcd.encoderPinSw = 0.28; //click 41 | lcd.lcdDCPin = NoPin; //DataControl Pin (A0) if none used set to NoPin 42 | lcd.panelButtonPin = NoPin; 43 | -------------------------------------------------------------------------------- /LPC/ExampleBoardConfig/board-BIQUSKR_v1.4.txt: -------------------------------------------------------------------------------- 1 | //Config file to define Hardware Pins LPC Boards. 2 | //Note: Each line should be less than 120 characters. 3 | // : Unwanted options can be commented out or set to NoPin. Lines commented out will get default values 4 | // : for pins the default is NoPin. 5 | // : Values for Arrays need to be contained within { and } 6 | // : Comments can be defined with // or # (comments are not supported inside arrays) 7 | // : Each config entry must be all on a single line. 8 | 9 | //SKR v1.4 10 | lpc.board = biquskr_1.4 11 | 12 | // Bed E0 E1 13 | heat.tempSensePins = {0.25, 0.24, 0.23}; //tb, th0, th1 14 | 15 | 16 | //**SPI Devices** 17 | 18 | // spiChannel 19 | // 0 SSP0 20 | // 1 SSP1 21 | // 2 SoftwareSPI (requires pins to be configured) 22 | 23 | //Only supports 1 External SDCard 24 | sdCard.external.csPin = 0.16; 25 | sdCard.external.cardDetectPin = 1.31; 26 | sdCard.external.spiFrequencyHz = 4000000; 27 | sdCard.external.spiChannel = 0; 28 | 29 | 30 | //LCD Pins (only ST9720 SPI currently supported) 31 | 32 | //setup the Software SPI Pins for LCD 33 | softwareSPI.pins = {1.20, NoPin, 1.18}; //Set to GPIO pins to use as SCK, MISO, MOSI 34 | 35 | lcd.spiChannel = 2; //2 = SWSPI - Use Software SPI Channel 36 | lcd.lcdCSPin = 1.19; //LCD Chip Select 37 | lcd.lcdBeepPin = 1.30; 38 | lcd.encoderPinA = 3.26; 39 | lcd.encoderPinB = 3.25; 40 | lcd.encoderPinSw = 0.28; //click 41 | lcd.lcdDCPin = NoPin; //DataControl Pin (A0) if none used set to NoPin 42 | lcd.panelButtonPin = NoPin; 43 | -------------------------------------------------------------------------------- /LPC/ExampleBoardConfig/board-MKSSBase_v1.3.txt: -------------------------------------------------------------------------------- 1 | //Config file to define Hardware Pins LPC Boards. 2 | //Note: Each line should be less than 120 characters. 3 | // : Unwanted options can be commented out or set to NoPin. Lines commented out will get default values 4 | // : for pins the default is NoPin. 5 | // : Values for Arrays need to be contained within { and } 6 | // : Comments can be defined with // or # (comments are not supported inside arrays) 7 | // : Each config entry must be all on a single line. 8 | 9 | 10 | 11 | 12 | lpc.board = mkssbase_1.3 13 | 14 | 15 | //LED blinks to indicate Platform is spinning or other diagnostic 16 | //Comment out or set to NoPin if not wanted. 17 | leds.diagnostic = 1.18; //RRF Diagnostics Pin (LED1) 18 | 19 | // Bed E0 E1 20 | heat.tempSensePins = {0.23, 0.24, 0.25}; //Max of 3 entries 21 | 22 | adc.prefilter.enable = true; //enable ADC prefilter 23 | 24 | 25 | 26 | //**SPI Devices** 27 | 28 | //Only supports 1 External SDCard 29 | sdCard.external.csPin = 0.28; 30 | sdCard.external.cardDetectPin = 0.27; 31 | sdCard.external.spiFrequencyHz = 4000000; 32 | 33 | 34 | //LCD Pins (only ST9720 SPI currently supported) 35 | lcd.lcdCSPin = 0.16; //LCD Chip Select 36 | lcd.lcdBeepPin = 1.31; 37 | lcd.encoderPinA = 3.25; 38 | lcd.encoderPinB = 3.26; 39 | lcd.encoderPinSw = 1.30; //click 40 | lcd.lcdDCPin = NoPin; //DataControl Pin (A0) if none used set to NoPin 41 | lcd.panelButtonPin = 2.11; //Extra button on RRD Panels 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /LPC/ExampleBoardConfig/board-ReArm_v1.0.txt: -------------------------------------------------------------------------------- 1 | //Config file to define Hardware Pins LPC Boards. 2 | //Note: Each line should be less than 120 characters. 3 | // : Unwanted options can be commented out or set to NoPin. Lines commented out will get default values 4 | // : for pins the default is NoPin. 5 | // : Values for Arrays need to be contained within { and } 6 | // : Comments can be defined with // or # (comments are not supported inside arrays) 7 | // : Each config entry must be all on a single line. 8 | 9 | 10 | 11 | lpc.board = rearm 12 | 13 | 14 | // ReArm Leds: 15 | //Play - 4.28; 16 | 17 | 18 | //LED blinks to indicate Platform is spinning or other diagnostic 19 | //Comment out or set to NoPin if not wanted. 20 | leds.diagnostic = 4.28; //RRF Diagnostics Pin (PlayLED) 21 | 22 | 23 | // Bed E0 E1 24 | heat.tempSensePins = {0.24, 0.23}; //Max of 3 entries 25 | 26 | atx.powerPin = 2.12; 27 | 28 | 29 | //**SPI Devices** 30 | 31 | // spiChannel 32 | // 0 SSP0 33 | // 1 SSP1 34 | // 2 SoftwareSPI (requires pins to be configured) 35 | 36 | 37 | //Only supports 1 External SDCard 38 | sdCard.external.csPin = 1.23; 39 | sdCard.external.cardDetectPin = 1.31; 40 | sdCard.external.spiFrequencyHz = 4000000; 41 | 42 | 43 | //LCD Pins (only ST9720 SPI currently supported) 44 | lcd.lcdCSPin = 0.16; //LCD Chip Select 45 | lcd.lcdBeepPin = 1.30; 46 | lcd.encoderPinA = 3.25; 47 | lcd.encoderPinB = 3.26; 48 | lcd.encoderPinSw = 2.11; //click 49 | lcd.lcdDCPin = 2.6; //DataControl Pin (A0) if none used set to NoPin 50 | lcd.panelButtonPin = 1.22; //Extra button on RRD Panels 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /LPC/ExampleBoardConfig/board-smoothieboard.txt: -------------------------------------------------------------------------------- 1 | //Config file to define Hardware Pins LPC Boards. 2 | //Note: Each line should be less than 120 characters. 3 | // : Unwanted options can be commented out or set to NoPin. Lines commented out will get default values 4 | // : for pins the default is NoPin. 5 | // : Values for Arrays need to be contained within { and } 6 | // : Comments can be defined with // or # (comments are not supported inside arrays) 7 | // : Each config entry must be all on a single line. 8 | 9 | 10 | lpc.board = smoothieboard 11 | 12 | 13 | 14 | //LED blinks to indicate Platform is spinning or other diagnostic 15 | //Comment out or set to NoPin if not wanted. 16 | leds.diagnostic = 1.18; //RRF Diagnostics Pin (LED1 on Smoothie) 17 | 18 | 19 | // Bed E0 E1 20 | heat.tempSensePins = {0.24, 0.23, 0.25}; //Max of 3 entries 21 | 22 | //**SPI Devices** 23 | 24 | // spiChannel 25 | // 0 SSP0 26 | // 1 SSP1 27 | // 2 SoftwareSPI (requires pins to be configured) 28 | 29 | 30 | //Only supports 1 External SDCard 31 | sdCard.external.csPin = 0.28; 32 | sdCard.external.cardDetectPin = 0.27; 33 | sdCard.external.spiFrequencyHz = 4000000; 34 | 35 | 36 | //LCD Pins (only ST9720 SPI currently supported) 37 | lcd.lcdCSPin = 0.16; //LCD Chip Select 38 | lcd.lcdBeepPin = 1.31; 39 | lcd.encoderPinA = 3.25; 40 | lcd.encoderPinB = 3.26; 41 | lcd.encoderPinSw = 1.30; //click 42 | lcd.lcdDCPin = NoPin; //DataControl Pin (A0) if none used set to NoPin 43 | lcd.panelButtonPin = 2.11; //Extra button on Viki and RRD Panels (reset/back etc configurable) 44 | 45 | 46 | -------------------------------------------------------------------------------- /Maths/BedLevelling-2-point.wxm: -------------------------------------------------------------------------------- 1 | /* [wxMaxima batch file version 1] [ DO NOT EDIT BY HAND! ]*/ 2 | /* [ Created with wxMaxima version 17.05.0 ] */ 3 | /* [wxMaxima: input start ] */ 4 | eq1:h=H+a*x+b*y; 5 | /* [wxMaxima: input end ] */ 6 | 7 | 8 | /* [wxMaxima: input start ] */ 9 | eq2:h0=H+a*x0+b*y0; 10 | /* [wxMaxima: input end ] */ 11 | 12 | 13 | /* [wxMaxima: input start ] */ 14 | eq3:h1=H+a*x1+b*y1; 15 | /* [wxMaxima: input end ] */ 16 | 17 | 18 | /* [wxMaxima: input start ] */ 19 | eq4:h2=H+a*(x0+y1-y0)+b*(y0-(x1-x0)); 20 | /* [wxMaxima: input end ] */ 21 | 22 | 23 | /* [wxMaxima: input start ] */ 24 | eq5:h2=h0; 25 | /* [wxMaxima: input end ] */ 26 | 27 | 28 | /* [wxMaxima: input start ] */ 29 | eq6:subst(eq5,eq4); 30 | /* [wxMaxima: input end ] */ 31 | 32 | 33 | /* [wxMaxima: input start ] */ 34 | eq7:solve([eq2,eq3,eq6],[a,b,H]); 35 | /* [wxMaxima: input end ] */ 36 | 37 | 38 | /* [wxMaxima: input start ] */ 39 | eq8:subst(eq7,eq1); 40 | /* [wxMaxima: input end ] */ 41 | 42 | 43 | /* [wxMaxima: input start ] */ 44 | eq9:dhbydh0=factor(diff(rhs(eq8),h0)); 45 | /* [wxMaxima: input end ] */ 46 | 47 | 48 | /* [wxMaxima: input start ] */ 49 | eq10:dhbydh1=factor(diff(rhs(eq8),h1)); 50 | /* [wxMaxima: input end ] */ 51 | 52 | 53 | /* [wxMaxima: input start ] */ 54 | eq11:expand((x1-x0)^2+(y1-y0)^2)=d^2; 55 | /* [wxMaxima: input end ] */ 56 | 57 | 58 | /* [wxMaxima: input start ] */ 59 | eq12:subst(eq11,eq9); 60 | /* [wxMaxima: input end ] */ 61 | 62 | 63 | /* [wxMaxima: input start ] */ 64 | eq13:subst(eq11,eq10); 65 | /* [wxMaxima: input end ] */ 66 | 67 | 68 | 69 | /* Maxima can't load/batch files which end with a comment! */ 70 | "Created with wxMaxima"$ 71 | -------------------------------------------------------------------------------- /Maths/BedLevelling-3-point.wxm: -------------------------------------------------------------------------------- 1 | /* [wxMaxima batch file version 1] [ DO NOT EDIT BY HAND! ]*/ 2 | /* [ Created with wxMaxima version 14.12.1 ] */ 3 | 4 | /* [wxMaxima: input start ] */ 5 | eq1:h=H+a*x+b*y; 6 | /* [wxMaxima: input end ] */ 7 | 8 | /* [wxMaxima: input start ] */ 9 | eq2:h0=H+a*x0+b*y0; 10 | /* [wxMaxima: input end ] */ 11 | 12 | /* [wxMaxima: input start ] */ 13 | eq3:h1=H+a*x1+b*y1; 14 | /* [wxMaxima: input end ] */ 15 | 16 | /* [wxMaxima: input start ] */ 17 | eq4:h2=H+a*x2+b*y2; 18 | /* [wxMaxima: input end ] */ 19 | 20 | /* [wxMaxima: input start ] */ 21 | eq5:solve([eq2,eq3,eq4],[a,b,H]); 22 | /* [wxMaxima: input end ] */ 23 | 24 | /* [wxMaxima: input start ] */ 25 | eq6:subst(eq5,eq1); 26 | /* [wxMaxima: input end ] */ 27 | 28 | /* [wxMaxima: input start ] */ 29 | eq7:dhbydh0=factor(diff(rhs(eq6),h0)); 30 | /* [wxMaxima: input end ] */ 31 | 32 | /* [wxMaxima: input start ] */ 33 | eq8:dhbydh1=factor(diff(rhs(eq6),h1)); 34 | /* [wxMaxima: input end ] */ 35 | 36 | /* [wxMaxima: input start ] */ 37 | eq9:dhbydh2=factor(diff(rhs(eq6),h2)); 38 | /* [wxMaxima: input end ] */ 39 | 40 | /* [wxMaxima: input start ] */ 41 | eq10:x1*y2-x0*y2-x2*y1+x0*y1+x2*y0-x1*y0=d; 42 | /* [wxMaxima: input end ] */ 43 | 44 | /* [wxMaxima: input start ] */ 45 | eq11:subst(eq10,eq7); 46 | /* [wxMaxima: input end ] */ 47 | 48 | /* [wxMaxima: input start ] */ 49 | eq12:subst(eq10,eq8); 50 | /* [wxMaxima: input end ] */ 51 | 52 | /* [wxMaxima: input start ] */ 53 | eq13:subst(eq10,eq9); 54 | /* [wxMaxima: input end ] */ 55 | 56 | /* Maxima can't load/batch files which end with a comment! */ 57 | "Created with wxMaxima"$ 58 | -------------------------------------------------------------------------------- /Maths/BedLevelling-4-point.wxm: -------------------------------------------------------------------------------- 1 | /* [wxMaxima batch file version 1] [ DO NOT EDIT BY HAND! ]*/ 2 | /* [ Created with wxMaxima version 14.12.1 ] */ 3 | 4 | /* [wxMaxima: input start ] */ 5 | eq1:h=H+a*x+b*y+c*x*y; 6 | /* [wxMaxima: input end ] */ 7 | 8 | /* [wxMaxima: input start ] */ 9 | eq2:h0=H+a*x0+b*y0+c*x0*y0; 10 | /* [wxMaxima: input end ] */ 11 | 12 | /* [wxMaxima: input start ] */ 13 | eq3:h1=H+a*x1+b*y1+c*x1*y1; 14 | /* [wxMaxima: input end ] */ 15 | 16 | /* [wxMaxima: input start ] */ 17 | eq4:h2=H+a*x2+b*y2+c*x2*y2; 18 | /* [wxMaxima: input end ] */ 19 | 20 | /* [wxMaxima: input start ] */ 21 | eq5:h3=H+a*x3+b*y3+c*x3*y3; 22 | /* [wxMaxima: input end ] */ 23 | 24 | /* [wxMaxima: input start ] */ 25 | eq6:solve([eq2,eq3,eq4,eq5],[a,b,c,H]); 26 | /* [wxMaxima: input end ] */ 27 | 28 | /* [wxMaxima: input start ] */ 29 | eq7:subst(eq6,eq1); 30 | /* [wxMaxima: input end ] */ 31 | 32 | /* [wxMaxima: input start ] */ 33 | eq8:dhbydh0=factor(diff(rhs(eq7),h0)); 34 | /* [wxMaxima: input end ] */ 35 | 36 | /* [wxMaxima: input start ] */ 37 | eq9:dhbydh1=factor(diff(rhs(eq7),h1)); 38 | /* [wxMaxima: input end ] */ 39 | 40 | /* [wxMaxima: input start ] */ 41 | eq10:dhbydh2=factor(diff(rhs(eq7),h2)); 42 | /* [wxMaxima: input end ] */ 43 | 44 | /* [wxMaxima: input start ] */ 45 | eq11:dhbydh3=factor(diff(rhs(eq7),h3)); 46 | /* [wxMaxima: input end ] */ 47 | 48 | /* [wxMaxima: input start ] */ 49 | eq12:(x1*x3*y2*y3-x0*x3*y2*y3-x1*x2*y2*y3+x0*x2*y2*y3-x2*x3*y1*y3+x0* 50 | x3*y1*y3+x1*x2*y1*y3-x0*x1*y1*y3+x2*x3*y0*y3-x1*x3*y0*y3-x0*x2*y0*y3+x0*x1*y0*y3+x2*x3*y1*y2-x1*x3*y1*y2-x0*x2*y1*y2+x0*x1*y1*y2-x2*x3*y0*y2+x0*x3*y0*y2+x1*x2*y0*y2-x0*x1*y0* 51 | y2+x1*x3*y0*y1-x0*x3*y0*y1-x1*x2*y0*y1+x0*x2*y0*y1)=d; 52 | /* [wxMaxima: input end ] */ 53 | 54 | /* [wxMaxima: input start ] */ 55 | eq13:subst(eq12,eq8); 56 | /* [wxMaxima: input end ] */ 57 | 58 | /* [wxMaxima: input start ] */ 59 | eq14:subst(eq12,eq9); 60 | /* [wxMaxima: input end ] */ 61 | 62 | /* [wxMaxima: input start ] */ 63 | eq15:subst(eq12,eq10); 64 | /* [wxMaxima: input end ] */ 65 | 66 | /* [wxMaxima: input start ] */ 67 | eq16:subst(eq12,eq11); 68 | /* [wxMaxima: input end ] */ 69 | 70 | /* Maxima can't load/batch files which end with a comment! */ 71 | "Created with wxMaxima"$ 72 | -------------------------------------------------------------------------------- /Maths/closestPointOfApproach2d.wxmx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdavi/RepRapFirmware/374100d1498cf62eab9f571e048a7358b575f994/Maths/closestPointOfApproach2d.wxmx -------------------------------------------------------------------------------- /Maths/closestPointOfApproach3d.wxmx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdavi/RepRapFirmware/374100d1498cf62eab9f571e048a7358b575f994/Maths/closestPointOfApproach3d.wxmx -------------------------------------------------------------------------------- /Maths/trilateration-triple.wxmx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdavi/RepRapFirmware/374100d1498cf62eab9f571e048a7358b575f994/Maths/trilateration-triple.wxmx -------------------------------------------------------------------------------- /Maths/trilateration.wxmx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdavi/RepRapFirmware/374100d1498cf62eab9f571e048a7358b575f994/Maths/trilateration.wxmx -------------------------------------------------------------------------------- /Scripts/duet3_openocd.cfg: -------------------------------------------------------------------------------- 1 | # Atmel-ICE JTAG/SWD in-circuit debugger. 2 | interface cmsis-dap 3 | cmsis_dap_vid_pid 0x03eb 0x2141 4 | 5 | # Chip info 6 | set CHIPNAME atsame70q20 7 | source [find target/atsamv.cfg] 8 | 9 | -------------------------------------------------------------------------------- /Scripts/signdriver.bat: -------------------------------------------------------------------------------- 1 | cd ..rem CD to the RepRapFirmware root directory before running this 2 | "C:\Program Files (x86)\Windows Kits\10\bin\x86\Inf2Cat.exe" /driver:Driver /os:XP_X86,Vista_X86,Vista_X64,7_X86,7_X64,8_X86,8_X64,6_3_X86,6_3_X64,10_X86,10_X64 3 | set PASSWORD= 4 | set /P PASSWORD=Private key password: %=% 5 | "C:\Program Files (x86)\Windows Kits\10\bin\x86\signtool.exe" sign /f g:\EscherTechnologies.pfx /p %PASSWORD% /tr http://timestamp.comodoca.com /v Driver/duetinf.cat 6 | "C:\Program Files (x86)\Windows Kits\10\bin\x86\signtool.exe" verify /pa /tw Driver/duetinf.cat -------------------------------------------------------------------------------- /Tools/Windows/bossac.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdavi/RepRapFirmware/374100d1498cf62eab9f571e048a7358b575f994/Tools/Windows/bossac.exe -------------------------------------------------------------------------------- /Tools/Windows/listComPorts.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdavi/RepRapFirmware/374100d1498cf62eab9f571e048a7358b575f994/Tools/Windows/listComPorts.exe -------------------------------------------------------------------------------- /Tools/crc32appender/crc32appender.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "encoding/binary" 5 | "hash/crc32" 6 | "io/ioutil" 7 | "os" 8 | ) 9 | 10 | func main() { 11 | 12 | // Loop through arguments 13 | for _, f := range os.Args[1:] { 14 | 15 | // Read the file to memory and panic if it fails 16 | b, err := ioutil.ReadFile(f) 17 | if err != nil { 18 | panic(err) 19 | } 20 | // Calculate CRC32 with IEEE polynomials 21 | c := crc32.ChecksumIEEE(b) 22 | 23 | // Open the same file for appending and panic if it fails 24 | f, err := os.OpenFile(f, os.O_APPEND|os.O_WRONLY, 0644) 25 | if err != nil { 26 | panic(err) 27 | } 28 | defer f.Close() 29 | 30 | // Create little-endian represenation of CRC32 sum 31 | le := make([]byte, crc32.Size) 32 | binary.LittleEndian.PutUint32(le, c) 33 | 34 | // Append the CRC32 and panic if it fails 35 | if _, err = f.Write(le); err != nil { 36 | panic(err) 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Tools/crc32appender/linux-x86_64/crc32appender: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdavi/RepRapFirmware/374100d1498cf62eab9f571e048a7358b575f994/Tools/crc32appender/linux-x86_64/crc32appender -------------------------------------------------------------------------------- /Tools/crc32appender/macos-x86_64/crc32appender: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdavi/RepRapFirmware/374100d1498cf62eab9f571e048a7358b575f994/Tools/crc32appender/macos-x86_64/crc32appender -------------------------------------------------------------------------------- /Tools/crc32appender/win-x86_64/crc32appender.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdavi/RepRapFirmware/374100d1498cf62eab9f571e048a7358b575f994/Tools/crc32appender/win-x86_64/crc32appender.exe -------------------------------------------------------------------------------- /src/CAN/CanMessageGenericConstructor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CanMessageGenericConstructor.h 3 | * 4 | * Created on: 23 Jul 2019 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_CANMESSAGEGENERICCONSTRUCTOR_H_ 9 | #define SRC_CANMESSAGEGENERICCONSTRUCTOR_H_ 10 | 11 | #include "RepRapFirmware.h" 12 | 13 | #if SUPPORT_CAN_EXPANSION 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | class GCodeBuffer; 20 | 21 | class CanMessageGenericConstructor 22 | { 23 | public: 24 | CanMessageGenericConstructor(const ParamDescriptor *p_param) noexcept; 25 | 26 | // Populate from a GCode message. Throws if an error occurs. 27 | void PopulateFromCommand(GCodeBuffer& gb) THROWS(GCodeException); 28 | 29 | // Methods to add parameters 30 | void AddU64Param(char c, uint64_t v) THROWS(GCodeException); 31 | void AddUParam(char c, uint32_t v) THROWS(GCodeException); 32 | void AddIParam(char c, int32_t v) THROWS(GCodeException); 33 | void AddFParam(char c, float v) THROWS(GCodeException); 34 | void AddCharParam(char c, char v) THROWS(GCodeException); 35 | void AddStringParam(char c, const char* v) THROWS(GCodeException); 36 | 37 | GCodeResult SendAndGetResponse(CanMessageType msgType, CanAddress dest, const StringRef& reply) noexcept; 38 | 39 | private: 40 | // Append a value to the data, returning true if it wouldn't fit 41 | void StoreValue(const void *vp, size_t sz) THROWS(GCodeException); 42 | 43 | // Append a value to the data, returning true if it wouldn't fit 44 | template void StoreValue(const T& val) THROWS(GCodeException) { StoreValue(&val, sizeof(T)); } 45 | 46 | // Insert a value in the data, returning true if it wouldn't fit 47 | void InsertValue(const void *vp, size_t sz, size_t pos) THROWS(GCodeException); 48 | 49 | static GCodeException ConstructParseException(const char *msg) noexcept 50 | { 51 | return GCodeException(-1, -1, msg); 52 | } 53 | 54 | static GCodeException ConstructParseException(const char *msg, uint32_t param) noexcept 55 | { 56 | return GCodeException(-1, -1, msg, param); 57 | } 58 | 59 | const ParamDescriptor * const paramTable; 60 | size_t dataLen; 61 | CanMessageGeneric msg; 62 | }; 63 | 64 | #endif 65 | 66 | #endif /* SRC_CANMESSAGEGENERICCONSTRUCTOR_H_ */ 67 | -------------------------------------------------------------------------------- /src/CAN/CanMotion.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CanMotion.h 3 | * 4 | * Created on: 11 Aug 2019 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_CAN_CANMOTION_H_ 9 | #define SRC_CAN_CANMOTION_H_ 10 | 11 | #include "RepRapFirmware.h" 12 | 13 | #if SUPPORT_CAN_EXPANSION 14 | 15 | #include 16 | 17 | namespace CanMotion 18 | { 19 | void Init() noexcept; 20 | void StartMovement(const DDA& dda) noexcept; 21 | void AddMovement(const DDA& dda, const PrepParams& params, DriverId canDriver, int32_t steps, bool usePressureAdvance) noexcept; 22 | void FinishMovement(uint32_t moveStartTime) noexcept; 23 | bool CanPrepareMove() noexcept; 24 | CanMessageBuffer *GetUrgentMessage() noexcept; 25 | 26 | // The next 4 functions may be called from the step ISR, so they can't send CAN messages directly 27 | void InsertHiccup(uint32_t numClocks) noexcept; 28 | void StopDriver(bool isBeingPrepared, DriverId driver) noexcept; 29 | void StopAxis(bool isBeingPrepared, size_t axis) noexcept; 30 | void StopAll(bool isBeingPrepared) noexcept; 31 | } 32 | 33 | #endif 34 | 35 | #endif /* SRC_CAN_CANMOTION_H_ */ 36 | -------------------------------------------------------------------------------- /src/CAN/CommandProcessor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CommandProcessor.h 3 | * 4 | * Created on: 12 Aug 2019 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_CAN_COMMANDPROCESSOR_H_ 9 | #define SRC_CAN_COMMANDPROCESSOR_H_ 10 | 11 | #include "RepRapFirmware.h" 12 | 13 | #if SUPPORT_CAN_EXPANSION 14 | 15 | class CanMessageBuffer; 16 | 17 | namespace CommandProcessor 18 | { 19 | void ProcessReceivedMessage(CanMessageBuffer *buf) noexcept; // Process a received broadcast or request message and free the message buffer 20 | } 21 | 22 | #endif 23 | 24 | #endif /* SRC_CAN_COMMANDPROCESSOR_H_ */ 25 | -------------------------------------------------------------------------------- /src/CAN/ExpansionManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ExpansionManager.h 3 | * 4 | * Created on: 4 Feb 2020 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_CAN_EXPANSIONMANAGER_H_ 9 | #define SRC_CAN_EXPANSIONMANAGER_H_ 10 | 11 | #include 12 | 13 | #if SUPPORT_CAN_EXPANSION 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | NamedEnum(BoardState, uint8_t, unknown, flashing, flashFailed, resetting, running); 22 | 23 | struct ExpansionBoardData 24 | { 25 | ExpansionBoardData() noexcept; 26 | 27 | const char *typeName; 28 | MinMaxCurrent mcuTemp, vin, v12; 29 | BoardState state; 30 | }; 31 | 32 | class ExpansionManager INHERIT_OBJECT_MODEL 33 | { 34 | public: 35 | ExpansionManager() noexcept; 36 | 37 | unsigned int GetNumExpansionBoards() const noexcept { return numExpansionBoards; } 38 | void ProcessAnnouncement(CanMessageBuffer *buf) noexcept; 39 | 40 | // Firmware update and related functions 41 | GCodeResult ResetRemote(uint32_t boardAddress, GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeException); 42 | GCodeResult UpdateRemoteFirmware(uint32_t boardAddress, GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeException); 43 | 44 | void UpdateFinished(CanAddress address) noexcept; 45 | void UpdateFailed(CanAddress address) noexcept; 46 | bool IsFlashing() const noexcept { return numBoardsFlashing != 0; } 47 | 48 | void EmergencyStop() noexcept; 49 | 50 | protected: 51 | DECLARE_OBJECT_MODEL 52 | 53 | private: 54 | void UpdateBoardState(CanAddress address, BoardState newState) noexcept; 55 | const ExpansionBoardData& FindIndexedBoard(unsigned int index) const noexcept; 56 | 57 | unsigned int numExpansionBoards; 58 | unsigned int numBoardsFlashing; 59 | mutable volatile unsigned int lastIndexSearched; // the last board index we searched for, or 0 if invalid 60 | mutable volatile unsigned int lastAddressFound; // if lastIndexSearched is nonzero, this is the corresponding board address we found 61 | ExpansionBoardData boards[CanId::MaxCanAddress + 1]; // the first entry is a dummy one 62 | }; 63 | 64 | #endif // SUPPORT_CAN_EXPANSION 65 | 66 | #endif /* SRC_CAN_EXPANSIONMANAGER_H_ */ 67 | -------------------------------------------------------------------------------- /src/Display/Display.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Display.h 3 | * 4 | * Created on: 22 Jan 2018 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_DISPLAY_DISPLAY_H_ 9 | #define SRC_DISPLAY_DISPLAY_H_ 10 | 11 | #include "RepRapFirmware.h" 12 | 13 | #if SUPPORT_12864_LCD 14 | 15 | #include "RotaryEncoder.h" 16 | #include "ST7920/lcd7920.h" 17 | #include "Menu.h" 18 | #include "GCodes/GCodeResult.h" 19 | 20 | class Display 21 | { 22 | public: 23 | Display() noexcept; 24 | 25 | void Init() noexcept { } 26 | GCodeResult Configure(GCodeBuffer& gb, const StringRef& reply) noexcept; 27 | void Spin() noexcept; 28 | void Exit() noexcept; 29 | void Beep(unsigned int frequency, unsigned int milliseconds) noexcept; 30 | void SuccessBeep() noexcept; 31 | void ErrorBeep() noexcept; 32 | bool IsPresent() const noexcept { return lcd != nullptr; } 33 | void UpdatingFirmware() noexcept; 34 | 35 | private: 36 | Lcd7920 *lcd; 37 | Menu *menu; 38 | RotaryEncoder *encoder; 39 | uint32_t whenBeepStarted; 40 | uint32_t beepLength; 41 | uint32_t lastRefreshMillis; 42 | uint16_t mboxSeq; 43 | bool mboxActive; 44 | bool beepActive; 45 | bool updatingFirmware; 46 | }; 47 | 48 | #endif 49 | 50 | #endif /* SRC_DISPLAY_DISPLAY_H_ */ 51 | -------------------------------------------------------------------------------- /src/Display/RotaryEncoder.h: -------------------------------------------------------------------------------- 1 | #ifndef __RotaryEncoderIncluded 2 | #define __RotaryEncoderIncluded 3 | 4 | #include "RepRapFirmware.h" 5 | 6 | #if SUPPORT_12864_LCD 7 | 8 | // Class to manage a rotary encoder with a push button 9 | class RotaryEncoder 10 | { 11 | const Pin pin0, pin1, pinButton; 12 | int ppc; 13 | int encoderChange; 14 | unsigned int encoderState; 15 | bool buttonState; 16 | bool newPress; 17 | bool reverseDirection; 18 | uint32_t whenSame; 19 | 20 | unsigned int ReadEncoderState() const noexcept; 21 | 22 | static constexpr uint32_t DebounceMillis = 5; 23 | 24 | public: 25 | RotaryEncoder(Pin p0, Pin p1, Pin pb) noexcept; 26 | 27 | void Init(int pulsesPerClick) noexcept; 28 | void Poll() noexcept; 29 | int GetChange() noexcept; 30 | bool GetButtonPress() noexcept; 31 | int GetPulsesPerClick() const noexcept { return ppc; } 32 | }; 33 | 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/Duet3_V05/Pins_Duet3_V05.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Pins_DuetNG.cpp 3 | * 4 | * Created on: 31 Mar 2019 5 | * Author: David 6 | */ 7 | 8 | #include "RepRapFirmware.h" 9 | 10 | // Hardware-dependent pins functions 11 | 12 | // Function to look up a pin name pass back the corresponding index into the pin table 13 | // On this platform, the mapping from pin names to pins is fixed, so this is a simple lookup 14 | bool LookupPinName(const char*pn, LogicalPin& lpin, bool& hardwareInverted) 15 | { 16 | if (StringEqualsIgnoreCase(pn, NoPinName)) 17 | { 18 | lpin = NoLogicalPin; 19 | hardwareInverted = false; 20 | return true; 21 | } 22 | 23 | for (size_t lp = 0; lp < ARRAY_SIZE(PinTable); ++lp) 24 | { 25 | const char *q = PinTable[lp].names; 26 | while (*q != 0) 27 | { 28 | // Try the next alias in the list of names for this pin 29 | const char *p = pn; 30 | bool hwInverted = (*q == '!'); 31 | if (hwInverted) 32 | { 33 | ++q; 34 | } 35 | while (*q != ',' && *q != 0 && *p == *q) 36 | { 37 | ++p; 38 | ++q; 39 | } 40 | if (*p == 0 && (*q == 0 || *q == ',')) 41 | { 42 | // Found a match 43 | lpin = (LogicalPin)lp; 44 | hardwareInverted = hwInverted; 45 | return true; 46 | } 47 | 48 | // Skip to the start of the next alias 49 | while (*q != 0 && *q != ',') 50 | { 51 | ++q; 52 | } 53 | if (*q == ',') 54 | { 55 | ++q; 56 | } 57 | } 58 | } 59 | return false; 60 | } 61 | 62 | // End 63 | -------------------------------------------------------------------------------- /src/Duet3_V06/Pins_Duet3_V06.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Pins_DuetNG.cpp 3 | * 4 | * Created on: 31 Mar 2019 5 | * Author: David 6 | */ 7 | 8 | #include "RepRapFirmware.h" 9 | 10 | // Hardware-dependent pins functions 11 | 12 | // Function to look up a pin name pass back the corresponding index into the pin table 13 | // On this platform, the mapping from pin names to pins is fixed, so this is a simple lookup 14 | bool LookupPinName(const char*pn, LogicalPin& lpin, bool& hardwareInverted) noexcept 15 | { 16 | if (StringEqualsIgnoreCase(pn, NoPinName)) 17 | { 18 | lpin = NoLogicalPin; 19 | hardwareInverted = false; 20 | return true; 21 | } 22 | 23 | for (size_t lp = 0; lp < ARRAY_SIZE(PinTable); ++lp) 24 | { 25 | const char *q = PinTable[lp].names; 26 | while (*q != 0) 27 | { 28 | // Try the next alias in the list of names for this pin 29 | const char *p = pn; 30 | bool hwInverted = (*q == '!'); 31 | if (hwInverted) 32 | { 33 | ++q; 34 | } 35 | while (*q != ',' && *q != 0 && *p == *q) 36 | { 37 | ++p; 38 | ++q; 39 | } 40 | if (*p == 0 && (*q == 0 || *q == ',')) 41 | { 42 | // Found a match 43 | lpin = (LogicalPin)lp; 44 | hardwareInverted = hwInverted; 45 | return true; 46 | } 47 | 48 | // Skip to the start of the next alias 49 | while (*q != 0 && *q != ',') 50 | { 51 | ++q; 52 | } 53 | if (*q == ',') 54 | { 55 | ++q; 56 | } 57 | } 58 | } 59 | return false; 60 | } 61 | 62 | // End 63 | -------------------------------------------------------------------------------- /src/DuetM/Pins_DuetM.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Pins_DuetM.cpp 3 | * 4 | * Created on: 15 Apr 2019 5 | * Author: David 6 | */ 7 | 8 | #include "RepRapFirmware.h" 9 | 10 | // Hardware-dependent pins functions 11 | 12 | // Function to look up a pin name pass back the corresponding index into the pin table 13 | // On this platform, the mapping from pin names to pins is fixed, so this is a simple lookup 14 | bool LookupPinName(const char*pn, LogicalPin& lpin, bool& hardwareInverted) noexcept 15 | { 16 | if (StringEqualsIgnoreCase(pn, NoPinName)) 17 | { 18 | lpin = NoLogicalPin; 19 | hardwareInverted = false; 20 | return true; 21 | } 22 | 23 | for (size_t lp = 0; lp < ARRAY_SIZE(PinTable); ++lp) 24 | { 25 | const char *q = PinTable[lp].names; 26 | while (*q != 0) 27 | { 28 | // Try the next alias in the list of names for this pin 29 | const char *p = pn; 30 | bool hwInverted = (*q == '!'); 31 | if (hwInverted) 32 | { 33 | ++q; 34 | } 35 | while (*q != ',' && *q != 0 && *p == *q) 36 | { 37 | ++p; 38 | ++q; 39 | } 40 | if (*p == 0 && (*q == 0 || *q == ',')) 41 | { 42 | // Found a match 43 | lpin = (LogicalPin)lp; 44 | hardwareInverted = hwInverted; 45 | return true; 46 | } 47 | 48 | // Skip to the start of the next alias 49 | while (*q != 0 && *q != ',') 50 | { 51 | ++q; 52 | } 53 | if (*q == ',') 54 | { 55 | ++q; 56 | } 57 | } 58 | } 59 | return false; 60 | } 61 | 62 | // End 63 | -------------------------------------------------------------------------------- /src/DuetNG/DueXn.h: -------------------------------------------------------------------------------- 1 | /* 2 | * DueXn.h 3 | * 4 | * Created on: 19 Oct 2016 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_DUETNG_DUEXN_H_ 9 | #define SRC_DUETNG_DUEXN_H_ 10 | 11 | #include "ecv.h" 12 | #include "Core.h" 13 | #include "MessageType.h" 14 | 15 | enum class ExpansionBoardType : uint8_t 16 | { 17 | none, 18 | DueX0, 19 | DueX2, 20 | DueX5 21 | }; 22 | 23 | namespace DuetExpansion 24 | { 25 | ExpansionBoardType DueXnInit() noexcept; // Look for a DueXn, initialise it and return which expansion board is attached 26 | void AdditionalOutputInit() noexcept; // Look for an additional output pin expander 27 | void DueXnTaskInit() noexcept; // Create the DueXn task and enable the associated interrupt from the DueXn 28 | const char* _ecv_array null GetExpansionBoardName() noexcept; // Return the name of the expansion board, or nullptr if no expansion board 29 | const char* _ecv_array null GetAdditionalExpansionBoardName() noexcept; // Return the name of the additional expansion board, or nullptr if no expansion board 30 | void SetPinMode(Pin pin, PinMode mode) noexcept; // Set the I/O mode of a pin 31 | bool DigitalRead(Pin pin) noexcept; // Read a pin 32 | void DigitalWrite(Pin pin, bool high) noexcept; // Write a pin 33 | void AnalogOut(Pin pin, float pwm) noexcept; // Set the PWM value on this pin 34 | uint16_t DiagnosticRead() noexcept; // Diagnose the SX1509 by setting all pins as inputs and reading them 35 | void Diagnostics(MessageType mtype) noexcept; // Print diagnostic data 36 | }; 37 | 38 | #endif /* SRC_DUETNG_DUEXN_H_ */ 39 | -------------------------------------------------------------------------------- /src/DuetNG/Pins_DuetNG.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Pins_DuetNG.cpp 3 | * 4 | * Created on: 31 Mar 2019 5 | * Author: David 6 | */ 7 | 8 | #include "RepRapFirmware.h" 9 | 10 | // Hardware-dependent pins functions 11 | 12 | // Function to look up a pin name pass back the corresponding index into the pin table 13 | // On this platform, the mapping from pin names to pins is fixed, so this is a simple lookup 14 | bool LookupPinName(const char*pn, LogicalPin& lpin, bool& hardwareInverted) noexcept 15 | { 16 | if (StringEqualsIgnoreCase(pn, NoPinName)) 17 | { 18 | lpin = NoLogicalPin; 19 | hardwareInverted = false; 20 | return true; 21 | } 22 | 23 | for (size_t lp = 0; lp < ARRAY_SIZE(PinTable); ++lp) 24 | { 25 | const char *q = PinTable[lp].names; 26 | while (*q != 0) 27 | { 28 | // Try the next alias in the list of names for this pin 29 | const char *p = pn; 30 | bool hwInverted = (*q == '!'); 31 | if (hwInverted) 32 | { 33 | ++q; 34 | } 35 | while (*q != ',' && *q != 0 && *p == *q) 36 | { 37 | ++p; 38 | ++q; 39 | } 40 | if (*p == 0 && (*q == 0 || *q == ',')) 41 | { 42 | // Found a match 43 | lpin = (LogicalPin)lp; 44 | hardwareInverted = hwInverted; 45 | return true; 46 | } 47 | 48 | // Skip to the start of the next alias 49 | while (*q != 0 && *q != ',') 50 | { 51 | ++q; 52 | } 53 | if (*q == ',') 54 | { 55 | ++q; 56 | } 57 | } 58 | } 59 | return false; 60 | } 61 | 62 | // End 63 | -------------------------------------------------------------------------------- /src/Endstops/Endstop.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Endstop.cpp 3 | * 4 | * Created on: 4 Apr 2019 5 | * Author: David 6 | */ 7 | 8 | #include "Endstop.h" 9 | 10 | // Endstop base class 11 | DriversBitmap EndstopOrZProbe::stalledDrivers; // used to track which drivers are reported as stalled, for stall detect endstops and stall detect Z probes 12 | 13 | #if SUPPORT_OBJECT_MODEL 14 | 15 | // Object model table and functions 16 | // Note: if using GCC version 7.3.1 20180622 and lambda functions are used in this table, you must compile this file with option -std=gnu++17. 17 | // Otherwise the table will be allocated in RAM instead of flash, which wastes too much RAM. 18 | 19 | // Macro to build a standard lambda function that includes the necessary type conversions 20 | #define OBJECT_MODEL_FUNC(...) OBJECT_MODEL_FUNC_BODY(Endstop, __VA_ARGS__) 21 | 22 | constexpr ObjectModelTableEntry Endstop::objectModelTable[] = 23 | { 24 | // Within each group, these entries must be in alphabetical order 25 | // 0. Endstop members 26 | { "triggered", OBJECT_MODEL_FUNC(self->Stopped() == EndStopHit::atStop), ObjectModelEntryFlags::live }, 27 | { "type", OBJECT_MODEL_FUNC(self->GetEndstopType().ToString()), ObjectModelEntryFlags::none }, 28 | }; 29 | 30 | constexpr uint8_t Endstop::objectModelTableDescriptor[] = { 1, 2 }; 31 | 32 | DEFINE_GET_OBJECT_MODEL_TABLE(Endstop) 33 | 34 | #endif 35 | 36 | Endstop::Endstop(uint8_t p_axis, EndStopPosition pos) noexcept : axis(p_axis), atHighEnd(pos == EndStopPosition::highEndStop) 37 | { 38 | } 39 | 40 | // End 41 | -------------------------------------------------------------------------------- /src/Endstops/LocalZProbe.h: -------------------------------------------------------------------------------- 1 | /* 2 | * LocalZProbe.h 3 | * 4 | * Created on: 14 Sep 2019 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_ENDSTOPS_LOCALZPROBE_H_ 9 | #define SRC_ENDSTOPS_LOCALZPROBE_H_ 10 | 11 | #include "ZProbe.h" 12 | #include 13 | 14 | class LocalZProbe final : public ZProbe 15 | { 16 | public: 17 | void* operator new(size_t sz) noexcept { return FreelistManager::Allocate(); } 18 | void operator delete(void* p) noexcept { FreelistManager::Release(p); } 19 | 20 | LocalZProbe(unsigned int num) noexcept : ZProbe(num, ZProbeType::none) { } 21 | ~LocalZProbe() noexcept override; 22 | void SetIREmitter(bool on) const noexcept override; 23 | uint16_t GetRawReading() const noexcept override; 24 | void SetProbing(bool isProbing) noexcept override; 25 | GCodeResult AppendPinNames(const StringRef& str) noexcept override; 26 | GCodeResult Configure(GCodeBuffer& gb, const StringRef& reply, bool& seen) THROWS(GCodeException) override; 27 | GCodeResult SendProgram(const uint32_t zProbeProgram[], size_t len, const StringRef& reply) noexcept override; 28 | 29 | #if ALLOCATE_DEFAULT_PORTS 30 | bool AssignPorts(const char *pinNames, const StringRef& reply) noexcept; 31 | #endif 32 | 33 | private: 34 | IoPort inputPort; 35 | IoPort modulationPort; // the modulation port we are using 36 | 37 | // Variable for programming Smart Effector and other programmable Z probes 38 | static void TimerInterrupt(CallbackParameter param) noexcept; 39 | void Interrupt() noexcept; 40 | 41 | StepTimer timer; 42 | uint8_t progBytes[MaxZProbeProgramBytes]; 43 | size_t numBytes; 44 | size_t bytesSent; 45 | unsigned int bitsSent; 46 | StepTimer::Ticks bitTime; 47 | StepTimer::Ticks startTime; 48 | 49 | static const unsigned int bitsPerSecond = 1000; 50 | }; 51 | 52 | // If this is a dumb modulated IR probe, set the IR LED on or off. Called from the tick ISR, so inlined for speed. 53 | inline void LocalZProbe::SetIREmitter(bool on) const noexcept 54 | { 55 | if (type == ZProbeType::dumbModulated) 56 | { 57 | modulationPort.WriteDigital(on); 58 | } 59 | } 60 | 61 | #endif /* SRC_ENDSTOPS_LOCALZPROBE_H_ */ 62 | -------------------------------------------------------------------------------- /src/Endstops/RemoteZProbe.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RemoteZProbe.h 3 | * 4 | * Created on: 14 Sep 2019 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_ENDSTOPS_REMOTEZPROBE_H_ 9 | #define SRC_ENDSTOPS_REMOTEZPROBE_H_ 10 | 11 | #include "ZProbe.h" 12 | 13 | #if SUPPORT_CAN_EXPANSION 14 | 15 | #include 16 | 17 | class RemoteZProbe final : public ZProbe 18 | { 19 | public: 20 | void* operator new(size_t sz) noexcept { return FreelistManager::Allocate(); } 21 | void operator delete(void* p) noexcept { FreelistManager::Release(p); } 22 | 23 | RemoteZProbe(unsigned int num, CanAddress bn, ZProbeType p_type) noexcept : ZProbe(num, p_type), boardAddress(bn), state(false) { } 24 | ~RemoteZProbe() noexcept override; 25 | void SetIREmitter(bool on) const noexcept override { } 26 | uint16_t GetRawReading() const noexcept override; 27 | void SetProbing(bool isProbing) noexcept override; 28 | GCodeResult AppendPinNames(const StringRef& str) noexcept override; 29 | GCodeResult Configure(GCodeBuffer& gb, const StringRef& reply, bool& seen) THROWS(GCodeException) override; 30 | GCodeResult SendProgram(const uint32_t zProbeProgram[], size_t len, const StringRef& reply) noexcept override; 31 | void HandleRemoteInputChange(CanAddress src, uint8_t handleMinor, bool newState) noexcept override; 32 | 33 | GCodeResult Create(const StringRef& pinNames, const StringRef& reply) noexcept; 34 | 35 | private: 36 | CanAddress boardAddress; 37 | RemoteInputHandle handle; 38 | bool state; 39 | 40 | static constexpr uint16_t ActiveProbeReportInterval = 2; 41 | static constexpr uint16_t InactiveProbeReportInterval = 25; 42 | }; 43 | 44 | #endif 45 | 46 | #endif /* SRC_ENDSTOPS_REMOTEZPROBE_H_ */ 47 | -------------------------------------------------------------------------------- /src/Endstops/StallDetectionEndstop.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StallDetectionEndstop.h 3 | * 4 | * Created on: 15 Sep 2019 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_ENDSTOPS_STALLDETECTIONENDSTOP_H_ 9 | #define SRC_ENDSTOPS_STALLDETECTIONENDSTOP_H_ 10 | 11 | #include "Endstop.h" 12 | 13 | // Motor stall detection endstop 14 | class StallDetectionEndstop final : public Endstop 15 | { 16 | public: 17 | void* operator new(size_t sz) noexcept { return FreelistManager::Allocate(); } 18 | void operator delete(void* p) noexcept { FreelistManager::Release(p); } 19 | 20 | StallDetectionEndstop(uint8_t axis, EndStopPosition pos, bool p_individualMotors) noexcept; // for creating axis endstops 21 | StallDetectionEndstop() noexcept; // for creating the single extruders endstop 22 | 23 | EndStopType GetEndstopType() const noexcept override { return (individualMotors) ? EndStopType::motorStallIndividual : EndStopType::motorStallAny; } 24 | EndStopHit Stopped() const noexcept override; 25 | bool Prime(const Kinematics& kin, const AxisDriversConfig& axisDrivers) noexcept override; 26 | EndstopHitDetails CheckTriggered(bool goingSlow) noexcept override; 27 | bool Acknowledge(EndstopHitDetails what) noexcept override; 28 | void AppendDetails(const StringRef& str) noexcept override; 29 | void SetDrivers(DriversBitmap extruderDrivers) noexcept; // for setting which local extruder drives are active extruder endstops 30 | 31 | private: 32 | DriversBitmap driversMonitored; 33 | unsigned int numDriversLeft; 34 | bool individualMotors; 35 | bool stopAll; 36 | }; 37 | 38 | #endif /* SRC_ENDSTOPS_STALLDETECTIONENDSTOP_H_ */ 39 | -------------------------------------------------------------------------------- /src/Endstops/ZProbeEndstop.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ZProbeEndstop.h 3 | * 4 | * Created on: 15 Sep 2019 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_ENDSTOPS_ZPROBEENDSTOP_H_ 9 | #define SRC_ENDSTOPS_ZPROBEENDSTOP_H_ 10 | 11 | #include "Endstop.h" 12 | 13 | class ZProbeEndstop final : public Endstop 14 | { 15 | public: 16 | void* operator new(size_t sz) noexcept { return FreelistManager::Allocate(); } 17 | void operator delete(void* p) noexcept { FreelistManager::Release(p); } 18 | 19 | ZProbeEndstop(uint8_t axis, EndStopPosition pos) noexcept; 20 | 21 | EndStopType GetEndstopType() const noexcept override { return EndStopType::zProbeAsEndstop; } 22 | EndStopHit Stopped() const noexcept override; 23 | bool Prime(const Kinematics& kin, const AxisDriversConfig& axisDrivers) noexcept override; 24 | EndstopHitDetails CheckTriggered(bool goingSlow) noexcept override; 25 | bool Acknowledge(EndstopHitDetails what) noexcept override; 26 | void AppendDetails(const StringRef& str) noexcept override; 27 | 28 | private: 29 | size_t zProbeNumber; // which Z probe to use, always 0 for now 30 | bool stopAll; 31 | }; 32 | 33 | #endif /* SRC_ENDSTOPS_ZPROBEENDSTOP_H_ */ 34 | -------------------------------------------------------------------------------- /src/Fans/DotStarLed.h: -------------------------------------------------------------------------------- 1 | /* 2 | * DotStarLed.h 3 | * 4 | * Created on: 18 Jul 2018 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_FANS_DOTSTARLED_H_ 9 | #define SRC_FANS_DOTSTARLED_H_ 10 | 11 | #include "RepRapFirmware.h" 12 | #include "GCodes/GCodeResult.h" 13 | 14 | class GCodeBuffer; 15 | 16 | namespace DotStarLed 17 | { 18 | void Init() noexcept; 19 | GCodeResult SetColours(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeException); // handle M150 20 | }; 21 | 22 | #endif /* SRC_FANS_DOTSTARLED_H_ */ 23 | -------------------------------------------------------------------------------- /src/Fans/FansManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FansManager.h 3 | * 4 | * Created on: 3 Sep 2019 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_FANS_FANSMANAGER_H_ 9 | #define SRC_FANS_FANSMANAGER_H_ 10 | 11 | #include 12 | #include "Fan.h" 13 | #include "GCodes/GCodeResult.h" 14 | #include 15 | 16 | #if SUPPORT_CAN_EXPANSION 17 | # include 18 | struct CanMessageFansReport; 19 | #endif 20 | 21 | class GCodeBuffer; 22 | class LocalFan; 23 | 24 | class FansManager 25 | { 26 | public: 27 | FansManager() noexcept; 28 | FansManager(const FansManager&) = delete; 29 | 30 | void Init() noexcept; 31 | bool CheckFans(bool checkSensors) noexcept; 32 | GCodeResult ConfigureFanPort(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeException); 33 | bool ConfigureFan(unsigned int mcode, size_t fanNum, GCodeBuffer& gb, const StringRef& reply, bool& error) THROWS(GCodeException); 34 | float GetFanValue(size_t fanNum) const noexcept; 35 | GCodeResult SetFanValue(size_t fanNum, float speed, const StringRef& reply) noexcept; 36 | void SetFanValue(size_t fanNum, float speed) noexcept; 37 | bool IsFanControllable(size_t fanNum) const noexcept; 38 | const char *GetFanName(size_t fanNum) const noexcept; 39 | int32_t GetFanRPM(size_t fanNum) const noexcept; 40 | #if SUPPORT_CAN_EXPANSION 41 | void ProcessRemoteFanRpms(CanAddress src, const CanMessageFansReport& msg) noexcept; 42 | #endif 43 | #if HAS_MASS_STORAGE 44 | bool WriteFanSettings(FileStore *f) const noexcept; 45 | #endif 46 | 47 | // These need to be accessed by the OMT in class RepRap 48 | size_t GetNumFansToReport() const noexcept; 49 | ReadLockedPointer FindFan(size_t fanNum) const noexcept; 50 | 51 | static ReadWriteLock fansLock; 52 | 53 | private: 54 | LocalFan *CreateLocalFan(uint32_t fanNum, const char *pinNames, PwmFrequency freq, const StringRef& reply) noexcept; 55 | 56 | Fan *fans[MaxFans]; 57 | }; 58 | 59 | #endif /* SRC_FANS_FANSMANAGER_H_ */ 60 | -------------------------------------------------------------------------------- /src/Fans/LocalFan.h: -------------------------------------------------------------------------------- 1 | /* 2 | * LocalFan.h 3 | * 4 | * Created on: 3 Sep 2019 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_FANS_LOCALFAN_H_ 9 | #define SRC_FANS_LOCALFAN_H_ 10 | 11 | #include "Fan.h" 12 | 13 | class LocalFan : public Fan 14 | { 15 | public: 16 | LocalFan(unsigned int fanNum) noexcept; 17 | ~LocalFan() noexcept; 18 | 19 | bool Check(bool checkSensors) noexcept override; // update the fan PWM returning true if it is a thermostatic fan that is on 20 | bool IsEnabled() const noexcept override { return port.IsValid(); } 21 | int32_t GetRPM() const noexcept override; 22 | float GetPwm() const noexcept override { return lastVal; } 23 | GCodeResult SetPwmFrequency(PwmFrequency freq, const StringRef& reply) noexcept override; 24 | GCodeResult ReportPortDetails(const StringRef& str) const noexcept override; 25 | 26 | #if SUPPORT_CAN_EXPANSION 27 | void UpdateFromRemote(CanAddress src, const FanReport& report) noexcept override { } 28 | #endif 29 | 30 | bool AssignPorts(const char *pinNames, const StringRef& reply) noexcept; 31 | 32 | void Interrupt() noexcept; 33 | 34 | protected: 35 | GCodeResult Refresh(const StringRef& reply) noexcept override; 36 | bool UpdateFanConfiguration(const StringRef& reply) noexcept override; 37 | 38 | private: 39 | void SetHardwarePwm(float pwmVal) noexcept; 40 | void InternalRefresh(bool checkSensors) noexcept; 41 | 42 | PwmPort port; // port used to control the fan 43 | IoPort tachoPort; // port used to read the tacho 44 | 45 | float lastPwm; // the last PWM value we wrote to the hardware 46 | float lastVal; // the last PWM value we sent to the fan, not allowing for blipping, or -1 if we don't know it 47 | 48 | // Variables used to read the tacho 49 | static constexpr uint32_t fanMaxInterruptCount = 32; // number of fan interrupts that we average over 50 | uint32_t fanInterruptCount; // accessed only in ISR, so no need to declare it volatile 51 | volatile uint32_t fanLastResetTime; // time (in step clocks) at which we last reset the interrupt count, accessed inside and outside ISR 52 | volatile uint32_t fanInterval; // written by ISR, read outside the ISR 53 | 54 | uint32_t blipStartTime; 55 | bool blipping; 56 | }; 57 | 58 | #endif /* SRC_FANS_LOCALFAN_H_ */ 59 | -------------------------------------------------------------------------------- /src/Fans/RemoteFan.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RemoteFan.h 3 | * 4 | * Created on: 3 Sep 2019 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_FANS_REMOTEFAN_H_ 9 | #define SRC_FANS_REMOTEFAN_H_ 10 | 11 | #include "Fan.h" 12 | 13 | #if SUPPORT_CAN_EXPANSION 14 | 15 | #include "GCodes/GCodeResult.h" 16 | 17 | class RemoteFan : public Fan 18 | { 19 | public: 20 | RemoteFan(unsigned int fanNum, CanAddress boardNum) noexcept; 21 | ~RemoteFan() noexcept; 22 | 23 | bool Check(bool checkSensors) noexcept override; // update the fan PWM returning true if it is a thermostatic fan that is on 24 | bool IsEnabled() const noexcept override; 25 | int32_t GetRPM() const noexcept override { return lastRpm; } 26 | float GetPwm() const noexcept override { return lastPwm; } 27 | GCodeResult SetPwmFrequency(PwmFrequency freq, const StringRef& reply) noexcept override; 28 | GCodeResult ReportPortDetails(const StringRef& str) const noexcept override; 29 | void UpdateFromRemote(CanAddress src, const FanReport& report) noexcept override; 30 | 31 | GCodeResult ConfigurePort(const char *pinNames, PwmFrequency freq, const StringRef& reply) noexcept; 32 | 33 | protected: 34 | bool UpdateFanConfiguration(const StringRef& reply) noexcept override; 35 | GCodeResult Refresh(const StringRef& reply) noexcept override; 36 | 37 | private: 38 | int32_t lastRpm; 39 | float lastPwm; 40 | uint32_t whenLastReportReceived; 41 | CanAddress boardNumber; 42 | }; 43 | 44 | #endif 45 | 46 | #endif /* SRC_FANS_REMOTEFAN_H_ */ 47 | -------------------------------------------------------------------------------- /src/FilamentMonitors/Duet3DFilamentMonitor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Duet3DFilamentSensor.h 3 | * 4 | * Created on: 20 Jul 2017 5 | * Author: David 6 | * 7 | * This is the base class for filament monitors that use the Duet3D protocol for sending 16-bit words to the Duet. 8 | */ 9 | 10 | #ifndef SRC_FILAMENTSENSORS_DUET3DFILAMENTMONITOR_H_ 11 | #define SRC_FILAMENTSENSORS_DUET3DFILAMENTMONITOR_H_ 12 | 13 | #include "FilamentMonitor.h" 14 | 15 | class Duet3DFilamentMonitor : public FilamentMonitor 16 | { 17 | public: 18 | Duet3DFilamentMonitor(unsigned int extruder, unsigned int type) noexcept; 19 | 20 | bool Interrupt() noexcept override; 21 | 22 | protected: 23 | void InitReceiveBuffer() noexcept; 24 | 25 | enum class PollResult : uint8_t 26 | { 27 | incomplete, 28 | complete, 29 | error 30 | }; 31 | PollResult PollReceiveBuffer(uint16_t& measurement) noexcept; 32 | bool IsReceiving() const noexcept; 33 | bool IsWaitingForStartBit() const noexcept; 34 | 35 | protected: 36 | uint32_t overrunErrorCount; 37 | uint32_t polarityErrorCount; 38 | 39 | private: 40 | static constexpr size_t EdgeCaptureBufferSize = 64; // must be a power of 2 41 | 42 | // Buffer used to capture received data, and associated info 43 | uint32_t edgeCaptures[EdgeCaptureBufferSize]; 44 | size_t edgeCaptureReadPointer; 45 | volatile size_t edgeCaptureWritePointer; 46 | 47 | enum class RxdState : uint8_t 48 | { 49 | waitingForStartBit = 0, 50 | waitingForEndOfStartBit, 51 | waitingForNibble, 52 | errorRecovery1, 53 | errorRecovery2, 54 | errorRecovery3, 55 | errorRecovery4 56 | }; 57 | 58 | uint32_t startBitLength; 59 | uint32_t errorRecoveryStartTime; 60 | size_t lastBitChangeIndex; 61 | uint16_t valueBeingAssembled; 62 | uint8_t nibblesAssembled; 63 | RxdState state; 64 | }; 65 | 66 | #endif /* SRC_FILAMENTSENSORS_DUET3DFILAMENTMONITOR_H_ */ 67 | -------------------------------------------------------------------------------- /src/FilamentMonitors/SimpleFilamentMonitor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SimpleFilamentSensor.h 3 | * 4 | * Created on: 20 Jul 2017 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_FILAMENTSENSORS_SIMPLEFILAMENTMONITOR_H_ 9 | #define SRC_FILAMENTSENSORS_SIMPLEFILAMENTMONITOR_H_ 10 | 11 | #include "FilamentMonitor.h" 12 | 13 | class SimpleFilamentMonitor : public FilamentMonitor 14 | { 15 | public: 16 | SimpleFilamentMonitor(unsigned int extruder, unsigned int type) noexcept; 17 | 18 | bool Configure(GCodeBuffer& gb, const StringRef& reply, bool& seen) override; 19 | FilamentSensorStatus Check(bool isPrinting, bool fromIsr, uint32_t isrMillis, float filamentConsumed) noexcept override; 20 | FilamentSensorStatus Clear() noexcept override; 21 | void Diagnostics(MessageType mtype, unsigned int extruder) noexcept override; 22 | bool Interrupt() noexcept override; 23 | 24 | protected: 25 | DECLARE_OBJECT_MODEL 26 | 27 | private: 28 | void Poll() noexcept; 29 | 30 | bool highWhenNoFilament; 31 | bool filamentPresent; 32 | bool enabled; 33 | }; 34 | 35 | #endif /* SRC_FILAMENTSENSORS_SIMPLEFILAMENTMONITOR_H_ */ 36 | -------------------------------------------------------------------------------- /src/GCodes/GCodeChannel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GCodeChannel.h 3 | * 4 | * Created on: 04 Jul 2019 5 | * Author: Christian 6 | */ 7 | 8 | #ifndef SRC_GCODES_GCODEBUFFER_CODECHANNEL_H_ 9 | #define SRC_GCODES_GCODEBUFFER_CODECHANNEL_H_ 10 | 11 | #include 12 | #include 13 | 14 | NamedEnum(GCodeChannel, uint8_t, HTTP, Telnet, File, USB, Aux, Trigger, Queue, LCD, SBC, Daemon, Aux2, Autopause); 15 | 16 | constexpr size_t NumGCodeChannels = GCodeChannel::NumValues; 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /src/GCodes/GCodeException.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ParseException.cpp 3 | * 4 | * Created on: 21 Dec 2019 5 | * Author: David 6 | */ 7 | 8 | #include "GCodeException.h" 9 | 10 | #include 11 | #include 12 | 13 | // Construct the error message. This will be prefixed with "Error: " when it is returned to the user. 14 | void GCodeException::GetMessage(const StringRef &reply, const GCodeBuffer *gb) const noexcept 15 | { 16 | // Print the file location, if possible 17 | const bool inFile = gb != nullptr && gb->IsDoingFile(); 18 | if (inFile) 19 | { 20 | reply.copy((gb->IsDoingFileMacro()) ? "in file macro": "in GCode file"); 21 | if (line >= 0) 22 | { 23 | reply.catf(" line %d", line); 24 | if (column >= 0) 25 | { 26 | reply.catf(" column %d", column + 1); 27 | } 28 | } 29 | reply.cat(": "); 30 | } 31 | 32 | // Print the command letter/number, if possible 33 | if (gb != nullptr) 34 | { 35 | switch (gb->GetCommandLetter()) 36 | { 37 | case 'E': 38 | reply.cat("meta command: "); 39 | break; 40 | 41 | case 'G': 42 | case 'M': 43 | case 'T': 44 | if (gb->HasCommandNumber()) 45 | { 46 | reply.catf("%c%u: ", gb->GetCommandLetter(), gb->GetCommandNumber()); 47 | } 48 | break; 49 | 50 | case 'Q': // we use Q0 for comments 51 | default: 52 | break; 53 | } 54 | } 55 | 56 | // Print the message and any parameter 57 | if (haveStringParam) 58 | { 59 | reply.catf(message, stringParam.c_str()); 60 | } 61 | else 62 | { 63 | reply.catf(message, param.u); 64 | } 65 | } 66 | 67 | // End 68 | -------------------------------------------------------------------------------- /src/GCodes/GCodeException.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ParseException.h 3 | * 4 | * Created on: 21 Dec 2019 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_GCODES_GCODEEXCEPTION_H_ 9 | #define SRC_GCODES_GCODEEXCEPTION_H_ 10 | 11 | #include 12 | 13 | class GCodeException 14 | { 15 | public: 16 | GCodeException(int lin, int col, const char *msg) noexcept : line(lin), column(col), message(msg), haveStringParam(false) { } 17 | 18 | GCodeException(int lin, int col, const char *msg, const char *sparam) noexcept : line(lin), column(col), message(msg), haveStringParam(true) 19 | { 20 | stringParam.copy(sparam); 21 | } 22 | 23 | GCodeException(int lin, int col, const char *msg, uint32_t uparam) noexcept : line(lin), column(col), message(msg), haveStringParam(false) 24 | { 25 | param.u = uparam; 26 | } 27 | 28 | GCodeException(int lin, int col, const char *msg, int32_t iparam) noexcept : line(lin), column(col), message(msg), haveStringParam(false) 29 | { 30 | param.i = iparam; 31 | } 32 | 33 | void GetMessage(const StringRef& reply, const GCodeBuffer *gb) const noexcept; 34 | 35 | private: 36 | int line; 37 | int column; 38 | const char *message; 39 | union 40 | { 41 | int32_t i; 42 | uint32_t u; 43 | } param; 44 | bool haveStringParam; 45 | String stringParam; 46 | }; 47 | 48 | #endif /* SRC_GCODES_GCODEEXCEPTION_H_ */ 49 | -------------------------------------------------------------------------------- /src/GCodes/GCodeFileInfo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * GCodeFileInfo.cpp 3 | * 4 | * Created on: 11 Jan 2020 5 | * Author: David 6 | */ 7 | 8 | #include "GCodeFileInfo.h" 9 | 10 | void GCodeFileInfo::Init() noexcept 11 | { 12 | isValid = false; 13 | incomplete = true; 14 | firstLayerHeight = 0.0; 15 | objectHeight = 0.0; 16 | layerHeight = 0.0; 17 | printTime = simulatedTime = 0; 18 | numFilaments = 0; 19 | lastModifiedTime = 0; 20 | generatedBy.Clear(); 21 | fileSize = 0; 22 | for (size_t extr = 0; extr < MaxExtruders; extr++) 23 | { 24 | filamentNeeded[extr] = 0.0; 25 | } 26 | } 27 | 28 | unsigned int GCodeFileInfo::GetNumLayers() const noexcept 29 | { 30 | if (layerHeight <= 0.0) { return 0; } 31 | const float nl = (firstLayerHeight > 0.0) 32 | ? (objectHeight - firstLayerHeight)/layerHeight + 1 33 | : objectHeight/layerHeight; 34 | return rintf(max(nl, 0.0)); 35 | } 36 | 37 | // End 38 | -------------------------------------------------------------------------------- /src/GCodes/GCodeFileInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GCodeFileInfo.h 3 | * 4 | * Created on: 1 Apr 2019 5 | * Author: Christian 6 | */ 7 | 8 | #ifndef SRC_GCODES_GCODEFILEINFO_H_ 9 | #define SRC_GCODES_GCODEFILEINFO_H_ 10 | 11 | #include "RepRapFirmware.h" 12 | 13 | // Struct to hold Gcode file information 14 | struct GCodeFileInfo 15 | { 16 | GCodeFileInfo() noexcept { Init(); } 17 | void Init() noexcept; 18 | unsigned int GetNumLayers() const noexcept; 19 | 20 | FilePosition fileSize; 21 | time_t lastModifiedTime; 22 | float layerHeight; 23 | float firstLayerHeight; 24 | float objectHeight; 25 | float filamentNeeded[MaxExtruders]; 26 | uint32_t printTime; 27 | uint32_t simulatedTime; 28 | unsigned int numFilaments; 29 | bool isValid; 30 | bool incomplete; 31 | String generatedBy; 32 | }; 33 | 34 | #endif /* SRC_GCODES_GCODEFILEINFO_H_ */ 35 | -------------------------------------------------------------------------------- /src/GCodes/GCodeQueue.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GCodeQueue.h 3 | * 4 | * Created on: 22 Jun 2016 5 | * Author: Christian 6 | */ 7 | #ifndef GCODEQUEUE_H 8 | #define GCODEQUEUE_H 9 | 10 | #include "RepRapFirmware.h" 11 | #include "GCodeInput.h" 12 | 13 | class QueuedCode; 14 | 15 | const size_t BufferSizePerQueueItem = SHORT_GCODE_LENGTH; 16 | 17 | class GCodeQueue : public GCodeInput 18 | { 19 | public: 20 | GCodeQueue() noexcept; 21 | 22 | void Reset() noexcept override; // Clean all the cached data from this input 23 | bool FillBuffer(GCodeBuffer *gb) noexcept override; // If there is another move to execute at this time, fill a buffer 24 | size_t BytesCached() const noexcept override; // How many bytes have been cached? 25 | 26 | bool QueueCode(GCodeBuffer &gb, uint32_t scheduleAt) noexcept; // Queue a G-code 27 | void PurgeEntries() noexcept; // Remove stored codes when a print is being paused 28 | void Clear() noexcept; // Clean up all the stored codes 29 | bool IsIdle() const noexcept; // Return true if there is nothing to do 30 | 31 | void Diagnostics(MessageType mtype) noexcept; 32 | 33 | static bool ShouldQueueCode(GCodeBuffer &gb) THROWS(GCodeException); // Return true if this code should be queued 34 | 35 | private: 36 | QueuedCode *freeItems; 37 | QueuedCode *queuedItems; 38 | }; 39 | 40 | class QueuedCode 41 | { 42 | public: 43 | friend class GCodeQueue; 44 | 45 | QueuedCode(QueuedCode *n) noexcept : next(n), dataLength(0) { } 46 | QueuedCode *Next() const noexcept { return next; } 47 | 48 | private: 49 | QueuedCode *next; 50 | 51 | #if HAS_LINUX_INTERFACE 52 | bool isBinary; 53 | #endif 54 | char data[BufferSizePerQueueItem]; 55 | size_t dataLength; 56 | 57 | uint32_t executeAtMove; 58 | 59 | void AssignFrom(GCodeBuffer &gb) noexcept; 60 | void AssignTo(GCodeBuffer *gb) noexcept; 61 | }; 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /src/GCodes/GCodeResult.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GCodeResult.h 3 | * 4 | * Created on: 1 Oct 2017 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_GCODES_GCODERESULT_H_ 9 | #define SRC_GCODES_GCODERESULT_H_ 10 | 11 | #include 12 | #include 13 | 14 | // Enumeration to specify the result of attempting to process a GCode command 15 | // These are ordered such that errors > warnings > ok 16 | enum class GCodeResult : uint8_t 17 | { 18 | notFinished, // we haven't finished processing this command 19 | ok, // we have finished processing this code 20 | warning, 21 | warningNotSupported, 22 | error, 23 | errorNotSupported, 24 | notSupportedInCurrentMode, 25 | badOrMissingParameter, 26 | remoteInternalError 27 | }; 28 | 29 | // Convert a true/false error/no-error indication to a GCodeResult 30 | inline GCodeResult GetGCodeResultFromError(bool err) noexcept 31 | { 32 | return (err) ? GCodeResult::error : GCodeResult::ok; 33 | } 34 | 35 | // Convert a true/false finished/not-finished indication to a GCodeResult 36 | inline GCodeResult GetGCodeResultFromFinished(bool finished) noexcept 37 | { 38 | return (finished) ? GCodeResult::ok : GCodeResult::notFinished; 39 | } 40 | 41 | // Convert an error or warning result into a suitable generic message type. Should only be called with GCodeResult::warning or GCodeResult::error. 42 | inline MessageType GetGenericMessageType(GCodeResult rslt) 43 | { 44 | return (rslt == GCodeResult::warning) ? WarningMessage : ErrorMessage; 45 | } 46 | 47 | #endif /* SRC_GCODES_GCODERESULT_H_ */ 48 | -------------------------------------------------------------------------------- /src/GCodes/RestorePoint.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RestorePoint.h 3 | * 4 | * Created on: 14 Jun 2017 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_GCODES_RESTOREPOINT_H_ 9 | #define SRC_GCODES_RESTOREPOINT_H_ 10 | 11 | #include 12 | #include 13 | 14 | class RestorePoint INHERIT_OBJECT_MODEL 15 | { 16 | public: 17 | float moveCoords[MaxAxes]; // The axis locations when we paused 18 | float feedRate; // The feed rate for the current move 19 | float virtualExtruderPosition; // The virtual extruder position at the start of this move 20 | float proportionDone; // How much of this move we have already done (zero unless we interrupted a move) 21 | FilePosition filePos; // The file position that this move was read from 22 | float initialUserX, initialUserY; // If we paused during an arc move and proportionDone is nonzero, the X and Y user coordinates at the start of the move 23 | int toolNumber; // The tool number that was active 24 | float spindleSpeeds[MaxSpindles]; // The spindle RPMs that were set, negative if anticlockwise direction 25 | 26 | #if SUPPORT_LASER || SUPPORT_IOBITS 27 | LaserPwmOrIoBits laserPwmOrIoBits; // The output port bits setting for this move, or the laser power 28 | #endif 29 | 30 | RestorePoint() noexcept; 31 | void Init() noexcept; 32 | 33 | protected: 34 | DECLARE_OBJECT_MODEL 35 | OBJECT_MODEL_ARRAY(coordinates) 36 | OBJECT_MODEL_ARRAY(spindleSpeeds) 37 | }; 38 | 39 | #endif /* SRC_GCODES_RESTOREPOINT_H_ */ 40 | -------------------------------------------------------------------------------- /src/GCodes/Trigger.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Trigger.h 3 | * 4 | * Created on: 6 Jun 2019 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_GCODES_TRIGGER_H_ 9 | #define SRC_GCODES_TRIGGER_H_ 10 | 11 | #include "RepRapFirmware.h" 12 | #include "GCodeResult.h" 13 | #include "Hardware/IoPorts.h" 14 | 15 | class Trigger 16 | { 17 | public: 18 | Trigger() noexcept; 19 | 20 | void Init() noexcept; 21 | 22 | // Return true if this trigger is unused, i.e. it doesn't watch any pins 23 | bool IsUnused() const noexcept; 24 | 25 | // Check whether this trigger is active and update the input states 26 | bool Check() noexcept; 27 | 28 | // Handle M581 for this trigger 29 | GCodeResult Configure(unsigned int number, GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeException); 30 | 31 | // Handle M582 for this trigger 32 | bool CheckLevel() noexcept; 33 | 34 | private: 35 | static void AppendInputNames(AxesBitmap endstops, InputPortsBitmap inputs, const StringRef& reply) noexcept; 36 | 37 | AxesBitmap highLevelEndstops, lowLevelEndstops, endstopStates; 38 | InputPortsBitmap highLevelInputs, lowLevelInputs, inputStates; 39 | int8_t condition; 40 | }; 41 | 42 | #endif /* SRC_GCODES_TRIGGER_H_ */ 43 | -------------------------------------------------------------------------------- /src/GPIO/GpInPort.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GpInPort.h 3 | * 4 | * Created on: 11 Feb 2020 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_GPIO_GPINPORT_H_ 9 | #define SRC_GPIO_GPINPORT_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #if SUPPORT_CAN_EXPANSION 17 | # include 18 | #endif 19 | 20 | class GpInputPort INHERIT_OBJECT_MODEL 21 | { 22 | public: 23 | GpInputPort() noexcept : 24 | #if SUPPORT_CAN_EXPANSION 25 | boardAddress (CanId::MasterAddress), 26 | #endif 27 | currentState(false) { } 28 | GpInputPort(const GpInputPort&) = delete; 29 | 30 | bool GetState() const noexcept; 31 | bool IsUnused() const noexcept; 32 | 33 | #if SUPPORT_CAN_EXPANSION 34 | void SetState(CanAddress src, bool b) noexcept { if (src == boardAddress) { currentState = b; } } 35 | #endif 36 | 37 | GCodeResult Configure(uint32_t gpinNumber, GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeException); 38 | 39 | protected: 40 | DECLARE_OBJECT_MODEL 41 | 42 | private: 43 | IoPort port; // will be initialised by PwmPort default constructor 44 | #if SUPPORT_CAN_EXPANSION 45 | RemoteInputHandle handle; 46 | CanAddress boardAddress; 47 | #endif 48 | bool currentState; 49 | }; 50 | 51 | #endif /* SRC_GPIO_GPINPORT_H_ */ 52 | -------------------------------------------------------------------------------- /src/GPIO/GpOutPort.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GpOutPort.h 3 | * 4 | * Created on: 11 Feb 2020 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_GPIO_GPOUTPORT_H_ 9 | #define SRC_GPIO_GPOUTPORT_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | class GpOutputPort INHERIT_OBJECT_MODEL 17 | { 18 | public: 19 | GpOutputPort() noexcept 20 | : lastPwm(0.0) 21 | #if SUPPORT_CAN_EXPANSION 22 | , boardAddress(CanId::MasterAddress) 23 | #endif 24 | { } 25 | 26 | GpOutputPort(const GpOutputPort&) = delete; 27 | 28 | bool IsUnused() const noexcept; 29 | GCodeResult WriteAnalog(uint32_t gpioPortNumber, bool isServo, float pwm, const GCodeBuffer& gb, const StringRef& reply) noexcept; 30 | GCodeResult Configure(uint32_t gpioNumber, bool isServo, GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeException); 31 | 32 | #ifdef PCCB 33 | void Assign(const char *pinName) noexcept; 34 | #endif 35 | 36 | protected: 37 | DECLARE_OBJECT_MODEL 38 | 39 | private: 40 | PwmPort port; // will be initialised by PwmPort default constructor 41 | float lastPwm; 42 | #if SUPPORT_CAN_EXPANSION 43 | CanAddress boardAddress; 44 | #endif 45 | }; 46 | 47 | #endif /* SRC_GPIO_GPOUTPORT_H_ */ 48 | -------------------------------------------------------------------------------- /src/Hardware/Cache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Cache.h 3 | * 4 | * Created on: 22 Nov 2019 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_HARDWARE_CACHE_H_ 9 | #define SRC_HARDWARE_CACHE_H_ 10 | 11 | #include 12 | 13 | namespace Cache 14 | { 15 | void Init() noexcept; 16 | void Enable() noexcept; 17 | void Disable() noexcept; 18 | void Flush(const volatile void *start, size_t length) noexcept; 19 | void Invalidate(const volatile void *start, size_t length) noexcept; 20 | 21 | inline void FlushBeforeDMAReceive(const volatile void *start, size_t length) noexcept { Flush(start, length); } 22 | inline void InvalidateAfterDMAReceive(const volatile void *start, size_t length) noexcept { Invalidate(start, length); } 23 | inline void FlushBeforeDMASend(const volatile void *start, size_t length) noexcept { Flush(start, length); } 24 | 25 | #if SAM4E 26 | uint32_t GetHitCount() noexcept; 27 | #endif 28 | }; 29 | 30 | // Entry points that can be called from ASF C code 31 | extern "C" void CacheFlushBeforeDMAReceive(const volatile void *start, size_t length) noexcept; 32 | extern "C" void CacheInvalidateAfterDMAReceive(const volatile void *start, size_t length) noexcept; 33 | extern "C" void CacheFlushBeforeDMASend(const volatile void *start, size_t length) noexcept; 34 | 35 | #if USE_CACHE 36 | 37 | # if SAM4E 38 | 39 | // The SAM4E cache is write-through, so no need to flush it 40 | inline void Cache::Flush(const volatile void *start, size_t length) noexcept { } 41 | 42 | # endif 43 | 44 | #else 45 | 46 | inline void Cache::Init() noexcept {} 47 | inline void Cache::Enable() noexcept {} 48 | inline void Cache::Disable() noexcept {} 49 | inline void Cache::Flush(const volatile void *start, size_t length) noexcept {} 50 | inline void Cache::Invalidate(const volatile void *start, size_t length) noexcept {} 51 | 52 | #endif 53 | 54 | #endif /* SRC_HARDWARE_CACHE_H_ */ 55 | -------------------------------------------------------------------------------- /src/Hardware/DmacManager.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * DmacManager.cpp 3 | * 4 | * Created on: 12 Sep 2018 5 | * Author: David 6 | * 7 | * The purpose of this module is to service the DMA Complete interrupt from the XDMAC on the SAME70 8 | * and route the interrupts caused by the various DMA channels to the corresponding drivers. 9 | */ 10 | 11 | #include "DmacManager.h" 12 | 13 | #if SAME70 14 | 15 | namespace DmacManager 16 | { 17 | static StandardCallbackFunction callbackFunctions[NumDmaChannelsUsed] = { 0 }; 18 | static CallbackParameter callbackParameters[NumDmaChannelsUsed]; 19 | 20 | void Init() noexcept 21 | { 22 | pmc_enable_periph_clk(ID_XDMAC); 23 | for (unsigned int i = 0; i < NumDmaChannelsUsed; ++i) 24 | { 25 | XDMAC->XDMAC_CHID[i].XDMAC_CID = 0xFFFFFFFF; // disable all XDMAC interrupts from the channel 26 | } 27 | NVIC_EnableIRQ(XDMAC_IRQn); 28 | } 29 | 30 | void SetInterruptCallback(const uint8_t channel, StandardCallbackFunction fn, CallbackParameter param) noexcept 31 | { 32 | if (channel < NumDmaChannelsUsed) 33 | { 34 | callbackFunctions[channel] = fn; 35 | callbackParameters[channel] = param; 36 | } 37 | } 38 | } 39 | 40 | // DMAC interrupt service routine 41 | extern "C" void XDMAC_Handler() noexcept 42 | { 43 | uint32_t pendingChannels = XDMAC->XDMAC_GIS; 44 | for (size_t i = 0; i < NumDmaChannelsUsed; ++i) 45 | { 46 | if ((pendingChannels & 1u) != 0) 47 | { 48 | if (DmacManager::callbackFunctions[i] != nullptr) 49 | { 50 | DmacManager::callbackFunctions[i](DmacManager::callbackParameters[i]); // we rely on the callback to clear the interrupt 51 | } 52 | else 53 | { 54 | XDMAC->XDMAC_CHID[i].XDMAC_CID = 0xFFFFFFFF; // no callback, so just clear the interrupt 55 | } 56 | } 57 | pendingChannels >>= 1; 58 | } 59 | } 60 | 61 | #endif 62 | 63 | // End 64 | -------------------------------------------------------------------------------- /src/Hardware/DmacManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * DmacManager.h 3 | * 4 | * Created on: 12 Sep 2018 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_DMACMANAGER_H_ 9 | #define SRC_DMACMANAGER_H_ 10 | 11 | #include "RepRapFirmware.h" 12 | 13 | #if SAME70 14 | 15 | // DMAC peripheral identifiers for the SAME70 form table 36.1 in the data sheet. These don't seem to be defined anywhere in the ASF files. 16 | enum class DmaTrigSource : uint32_t 17 | { 18 | hsmci = 0, // both transmit and receive 19 | spi0tx, 20 | spi0rx, 21 | spi1tx, 22 | spi1rx, 23 | qspitx, 24 | qspirx, 25 | usart0tx, 26 | usart0rx, 27 | usart1tx, 28 | usart1rx, 29 | usart2tx, 30 | usart2rx, 31 | pwm0tx, 32 | twihs0tx, 33 | twihs0rx, 34 | twihs1tx, 35 | twihs1rx, 36 | twihs2tx, 37 | twihs2rx, 38 | uart0tx, 39 | uart0rx, 40 | uart1tx, 41 | uart1rx, 42 | uart2tx, 43 | uart2rx, 44 | uart3tx, 45 | uart3rx, 46 | uart4tx, 47 | uart4rx, 48 | dacctx, 49 | unused1, // ID 30 does not appear in the table 50 | ssctx, 51 | sscrx, 52 | pioarx, 53 | afec0rx, 54 | afec1rx, 55 | aestx, 56 | aesrx, 57 | pwm1tx, 58 | tc0rx, 59 | tc3rx, 60 | tc6rx, 61 | tc9rx, 62 | i2sc0txl, 63 | i2sc0rxl, 64 | i2sc1txl, 65 | i2sc1rxl, 66 | i2sc0txr, 67 | i2sc0rxr, 68 | i2sc1txr, 69 | i2sc1rxr, 70 | numPeripheralIds 71 | }; 72 | 73 | static_assert((uint32_t)DmaTrigSource::numPeripheralIds == 52, "Error in peripheral ID table"); 74 | 75 | namespace DmacManager 76 | { 77 | void Init() noexcept; 78 | void SetInterruptCallback(const uint8_t channel, StandardCallbackFunction fn, CallbackParameter param) noexcept; 79 | } 80 | 81 | #endif 82 | 83 | #endif /* SRC_DMACMANAGER_H_ */ 84 | -------------------------------------------------------------------------------- /src/Hardware/I2C.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * I2C.cpp 3 | * 4 | * Created on: 13 May 2019 5 | * Author: David 6 | */ 7 | 8 | #include "I2C.h" 9 | #include "Tasks.h" 10 | 11 | #if defined(I2C_IFACE) 12 | static bool i2cInitialised = false; 13 | #endif 14 | 15 | // Initialise the I2C interface, if not already done 16 | void I2C::Init() noexcept 17 | { 18 | #if defined(I2C_IFACE) 19 | if (!i2cInitialised) 20 | { 21 | MutexLocker lock(Tasks::GetI2CMutex()); 22 | if (!i2cInitialised) // test it again, now that we own the mutex 23 | { 24 | I2C_IFACE.BeginMaster(I2cClockFreq); 25 | i2cInitialised = true; 26 | } 27 | } 28 | #endif 29 | } 30 | 31 | #if defined(I2C_IFACE) 32 | 33 | #include "RTOSIface/RTOSIface.h" 34 | 35 | static TaskHandle twiTask = nullptr; // the task that is waiting for a TWI command to complete 36 | 37 | extern "C" void WIRE_ISR_HANDLER() noexcept 38 | { 39 | WIRE_INTERFACE->TWI_IDR = 0xFFFFFFFF; 40 | TaskBase::GiveFromISR(twiTask); // wake up the task 41 | twiTask = nullptr; 42 | } 43 | 44 | uint32_t I2C::statusWaitFunc(Twi *twi, uint32_t bitsToWaitFor) noexcept 45 | { 46 | uint32_t sr = twi->TWI_SR; 47 | if ((sr & bitsToWaitFor) == 0) 48 | { 49 | // Suspend this task until we get an interrupt indicating that a status bit that we are interested in has been set 50 | twiTask = TaskBase::GetCallerTaskHandle(); 51 | twi->TWI_IER = bitsToWaitFor; 52 | (void)TaskBase::Take(2); 53 | sr = twi->TWI_SR; 54 | twi->TWI_IDR = 0xFFFFFFFF; 55 | } 56 | return sr; 57 | } 58 | 59 | #endif 60 | 61 | // End 62 | -------------------------------------------------------------------------------- /src/Hardware/I2C.h: -------------------------------------------------------------------------------- 1 | /* 2 | * I2C.h 3 | * 4 | * Created on: 13 May 2019 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_HARDWARE_I2C_H_ 9 | #define SRC_HARDWARE_I2C_H_ 10 | 11 | #include "Wire.h" 12 | #include "RepRapFirmware.h" 13 | #include "Tasks.h" 14 | 15 | namespace I2C 16 | { 17 | void Init() noexcept; 18 | 19 | #ifdef I2C_IFACE 20 | 21 | #ifdef RTOS 22 | 23 | uint32_t statusWaitFunc(Twi *twi, uint32_t bitsToWaitFor) noexcept; 24 | 25 | // Transfer data to/from an I2C peripheral. 26 | // If the caller needs to do multiple I2C transactions without being interrupted, it should own the i2C mutex before calling this. 27 | // Otherwise the caller need nort own the mutex because it will be acquired here. 28 | inline size_t Transfer(uint16_t address, uint8_t *buffer, size_t numToWrite, size_t numToRead) noexcept 29 | { 30 | MutexLocker Lock(Tasks::GetI2CMutex()); 31 | return I2C_IFACE.Transfer(address, buffer, numToWrite, numToRead, statusWaitFunc); 32 | } 33 | 34 | #else 35 | 36 | // Transfer data to/from an I2C peripheral 37 | inline size_t Transfer(uint16_t address, uint8_t *buffer, size_t numToWrite, size_t numToRead) noexcept 38 | { 39 | return I2C_IFACE.Transfer(address, buffer, numToWrite, numToRead); 40 | } 41 | 42 | #endif 43 | 44 | #endif 45 | 46 | } 47 | 48 | #endif /* SRC_HARDWARE_I2C_H_ */ 49 | -------------------------------------------------------------------------------- /src/Heating/LocalHeater.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdavi/RepRapFirmware/374100d1498cf62eab9f571e048a7358b575f994/src/Heating/LocalHeater.cpp -------------------------------------------------------------------------------- /src/Heating/Sensors/AdditionalOutputSensor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AdditionalOutputSensor.h 3 | * 4 | * Created on: 17 Oct 2019 5 | * Author: manuel 6 | */ 7 | 8 | #ifndef ADDITIONALOUTPUTSENSOR_H_ 9 | #define ADDITIONALOUTPUTSENSOR_H_ 10 | 11 | # include "TemperatureSensor.h" 12 | 13 | class AdditionalOutputSensor : public TemperatureSensor 14 | { 15 | public: 16 | AdditionalOutputSensor(unsigned int sensorNum, const char *type, bool enforcePollOrder) noexcept; 17 | virtual ~AdditionalOutputSensor() noexcept; 18 | GCodeResult Configure(GCodeBuffer& gb, const StringRef& reply, bool& changed) override THROWS(GCodeException); 19 | void Poll() noexcept override; 20 | 21 | protected: 22 | uint8_t parentSensor; 23 | uint8_t outputNumber; 24 | 25 | private: 26 | bool enforcePollOrder; 27 | }; 28 | 29 | #endif /* ADDITIONALOUTPUTSENSOR_H_ */ 30 | -------------------------------------------------------------------------------- /src/Heating/Sensors/CpuTemperatureSensor.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * CpuTemperatureSensor.cpp 3 | * 4 | * Created on: 8 Jun 2017 5 | * Author: David 6 | */ 7 | 8 | #include "CpuTemperatureSensor.h" 9 | #include "Platform.h" 10 | #include "RepRap.h" 11 | 12 | #if HAS_CPU_TEMP_SENSOR 13 | 14 | CpuTemperatureSensor::CpuTemperatureSensor(unsigned int sensorNum) noexcept : TemperatureSensor(sensorNum, "Microcontroller embedded temperature sensor") 15 | { 16 | } 17 | 18 | void CpuTemperatureSensor::Poll() noexcept 19 | { 20 | const MinMaxCurrent temperatures = reprap.GetPlatform().GetMcuTemperatures(); 21 | SetResult(temperatures.current, TemperatureError::success); 22 | } 23 | 24 | #endif 25 | 26 | // End 27 | -------------------------------------------------------------------------------- /src/Heating/Sensors/CpuTemperatureSensor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CpuTemperatureSensor.h 3 | * 4 | * Created on: 8 Jun 2017 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_HEATING_SENSORS_CPUTEMPERATURESENSOR_H_ 9 | #define SRC_HEATING_SENSORS_CPUTEMPERATURESENSOR_H_ 10 | 11 | #include "TemperatureSensor.h" 12 | 13 | #if HAS_CPU_TEMP_SENSOR 14 | 15 | class CpuTemperatureSensor : public TemperatureSensor 16 | { 17 | public: 18 | CpuTemperatureSensor(unsigned int sensorNum) noexcept; 19 | 20 | void Poll() noexcept override; 21 | const char *GetShortSensorType() const noexcept override { return TypeName; } 22 | 23 | static constexpr const char *TypeName = "mcutemp"; 24 | }; 25 | 26 | #endif 27 | 28 | #endif /* SRC_HEATING_SENSORS_CPUTEMPERATURESENSOR_H_ */ 29 | -------------------------------------------------------------------------------- /src/Heating/Sensors/CurrentLoopTemperatureSensor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * LinearAdcTemperatureSensor.h 3 | * 4 | * Created on: 8 Jun 2017 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_HEATING_LINEARADCTEMPERATURESENSOR_H_ 9 | #define SRC_HEATING_LINEARADCTEMPERATURESENSOR_H_ 10 | 11 | #include "SpiTemperatureSensor.h" 12 | 13 | class CurrentLoopTemperatureSensor : public SpiTemperatureSensor 14 | { 15 | public: 16 | CurrentLoopTemperatureSensor(unsigned int sensorNum) noexcept; 17 | GCodeResult Configure(GCodeBuffer& gb, const StringRef& reply, bool& changed) override THROWS(GCodeException); 18 | const char *GetShortSensorType() const noexcept override { return TypeName; } 19 | void Poll() noexcept override; 20 | 21 | static constexpr const char *TypeName = "currentloop"; 22 | 23 | private: 24 | TemperatureError TryGetLinearAdcTemperature(float& t) noexcept; 25 | void CalcDerivedParameters() noexcept; 26 | 27 | // Configurable parameters 28 | float tempAt4mA, tempAt20mA; 29 | uint32_t chipChannel, isDifferential; 30 | 31 | // Derived parameters 32 | float minLinearAdcTemp, linearAdcDegCPerCount; 33 | 34 | static constexpr float DefaultTempAt4mA = 385.0; 35 | static constexpr float DefaultTempAt20mA = 1600.0; 36 | static constexpr uint32_t DefaultChipChannel = 0; 37 | }; 38 | 39 | #endif /* SRC_HEATING_LINEARADCTEMPERATURESENSOR_H_ */ 40 | -------------------------------------------------------------------------------- /src/Heating/Sensors/DhtSensor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * DhtSensor.h 3 | * 4 | * Created on: 15 Sep 2017 5 | * Author: Christian 6 | */ 7 | 8 | #ifndef SRC_HEATING_SENSORS_DHTSENSOR_H_ 9 | #define SRC_HEATING_SENSORS_DHTSENSOR_H_ 10 | 11 | #include "RepRapFirmware.h" 12 | 13 | #if SUPPORT_DHT_SENSOR 14 | 15 | # include "AdditionalOutputSensor.h" 16 | # include "SensorWithPort.h" 17 | # include "RTOSIface/RTOSIface.h" 18 | 19 | enum class DhtSensorType 20 | { 21 | Dht11, 22 | Dht21, 23 | Dht22 24 | }; 25 | 26 | // This class represents a DHT temperature sensor 27 | class DhtTemperatureSensor : public SensorWithPort 28 | { 29 | public: 30 | DhtTemperatureSensor(unsigned int sensorNum, DhtSensorType type) noexcept; 31 | ~DhtTemperatureSensor() noexcept; 32 | 33 | GCodeResult Configure(GCodeBuffer& gb, const StringRef& reply, bool& changed) override THROWS(GCodeException); 34 | TemperatureError GetLatestTemperature(float& t, uint8_t outputNumber = 0) noexcept override; 35 | const uint8_t GetNumAdditionalOutputs() const noexcept override { return 1; } 36 | void Poll() noexcept override; 37 | bool PollInTask() noexcept override; 38 | const char *GetShortSensorType() const noexcept override; 39 | 40 | void Interrupt() noexcept; 41 | void TakeReading() noexcept; 42 | TemperatureError ProcessReadings(float& t, float& h) noexcept; 43 | 44 | static constexpr const char *TypeNameDht11 = "dht11"; 45 | static constexpr const char *TypeNameDht21 = "dht21"; 46 | static constexpr const char *TypeNameDht22 = "dht22"; 47 | 48 | private: 49 | DhtSensorType type; 50 | 51 | float lastHumidity; 52 | uint8_t badTemperatureCount; 53 | 54 | uint32_t lastReadTime; 55 | volatile uint16_t lastPulseTime; 56 | volatile uint8_t numPulses; 57 | uint16_t pulses[41]; // 1 start bit + 40 data bits 58 | }; 59 | 60 | // This class represents a DHT humidity sensor 61 | class DhtHumiditySensor : public AdditionalOutputSensor 62 | { 63 | public: 64 | DhtHumiditySensor(unsigned int sensorNum) noexcept; 65 | ~DhtHumiditySensor() noexcept; 66 | 67 | const char *GetShortSensorType() const noexcept override { return TypeName; } 68 | 69 | static constexpr const char *TypeName = "dhthumidity"; 70 | }; 71 | 72 | #endif 73 | 74 | #endif /* SRC_HEATING_SENSORS_DHTSENSOR_H_ */ 75 | -------------------------------------------------------------------------------- /src/Heating/Sensors/LinearAnalogSensor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * LinearAnalogSensor.h 3 | * 4 | * Created on: 16 Apr 2019 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_HEATING_SENSORS_LINEARANALOGSENSOR_H_ 9 | #define SRC_HEATING_SENSORS_LINEARANALOGSENSOR_H_ 10 | 11 | #include "SensorWithPort.h" 12 | 13 | class LinearAnalogSensor : public SensorWithPort 14 | { 15 | public: 16 | LinearAnalogSensor(unsigned int sensorNum) noexcept; 17 | 18 | GCodeResult Configure(GCodeBuffer& gb, const StringRef& reply, bool& changed) override THROWS(GCodeException); 19 | void Poll() noexcept override; 20 | const char *GetShortSensorType() const noexcept override { return TypeName; } 21 | 22 | static constexpr const char *TypeName = "linearanalog"; 23 | 24 | private: 25 | void CalcDerivedParameters() noexcept; 26 | 27 | // Configurable parameters 28 | float lowTemp, highTemp; 29 | bool filtered; 30 | 31 | // Derived parameters 32 | int adcFilterChannel; 33 | float linearIncreasePerCount; 34 | 35 | static constexpr float DefaultLowTemp = 0.0; 36 | static constexpr float DefaultHighTemp = 100.0; 37 | 38 | // ADC resolution 39 | static constexpr unsigned int AdcBits = 12; // the ADCs in the SAM processors are 12-bit 40 | static constexpr int32_t UnfilteredAdcRange = 1 << AdcBits; // The readings we pass in should be in range 0..(AdcRange - 1) 41 | static constexpr unsigned int AdcOversampleBits = 2; // we use 2-bit oversampling 42 | static constexpr int32_t FilteredAdcRange = 1 << (AdcBits + AdcOversampleBits); // The readings we pass in should be in range 0..(AdcRange - 1) 43 | }; 44 | 45 | #endif /* SRC_HEATING_SENSORS_LINEARANALOGSENSOR_H_ */ 46 | -------------------------------------------------------------------------------- /src/Heating/Sensors/RemoteSensor.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * RemoteSensor.cpp 3 | * 4 | * Created on: 23 Jul 2019 5 | * Author: David 6 | */ 7 | 8 | #include "RemoteSensor.h" 9 | 10 | #if SUPPORT_CAN_EXPANSION 11 | 12 | #include "CAN/CanMessageGenericConstructor.h" 13 | #include "CanMessageBuffer.h" 14 | 15 | constexpr uint32_t RemoteTemperatureTimeoutMillis = 1000; 16 | 17 | RemoteSensor::RemoteSensor(unsigned int sensorNum, CanAddress pBoardAddress) noexcept 18 | : TemperatureSensor(sensorNum, "remote"), boardAddress(pBoardAddress) 19 | { 20 | } 21 | 22 | GCodeResult RemoteSensor::Configure(GCodeBuffer& gb, const StringRef& reply, bool& changed) 23 | { 24 | TryConfigureSensorName(gb, changed); 25 | CanMessageGenericConstructor cons(M308Params); 26 | cons.PopulateFromCommand(gb); 27 | const GCodeResult ret = cons.SendAndGetResponse(CanMessageType::m308, boardAddress, reply); 28 | if ((ret == GCodeResult::ok || ret == GCodeResult::warning) && StringStartsWith(reply.c_str(), "type ")) 29 | { 30 | // It's just a query for the sensor parameters, so prefix the sensor number and name 31 | String temp; 32 | temp.printf("Sensor %u ", GetSensorNumber()); 33 | if (GetSensorName() != nullptr) 34 | { 35 | temp.catf("(%s) ", GetSensorName()); 36 | } 37 | reply.Insert(0, temp.c_str()); 38 | } 39 | else 40 | { 41 | changed = true; 42 | } 43 | return ret; 44 | } 45 | 46 | void RemoteSensor::UpdateRemoteTemperature(CanAddress src, const CanSensorReport& report) noexcept 47 | { 48 | if (src == boardAddress) 49 | { 50 | SetResult(report.temperature, (TemperatureError)report.errorCode); 51 | } 52 | } 53 | 54 | #endif 55 | 56 | // End 57 | -------------------------------------------------------------------------------- /src/Heating/Sensors/RemoteSensor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RemoteSensor.h 3 | * 4 | * Created on: 23 Jul 2019 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_HEATING_SENSORS_REMOTESENSOR_H_ 9 | #define SRC_HEATING_SENSORS_REMOTESENSOR_H_ 10 | 11 | #include "TemperatureSensor.h" 12 | 13 | #if SUPPORT_CAN_EXPANSION 14 | 15 | class RemoteSensor : public TemperatureSensor 16 | { 17 | public: 18 | RemoteSensor(unsigned int sensorNum, CanAddress pBoardAddress) noexcept; 19 | 20 | GCodeResult Configure(GCodeBuffer& gb, const StringRef& reply, bool& changed) override THROWS(GCodeException); 21 | CanAddress GetBoardAddress() const noexcept override { return boardAddress; } 22 | void Poll() noexcept override { } // nothing to do here because reception of CAN messages update the reading 23 | void UpdateRemoteTemperature(CanAddress src, const CanSensorReport& report) noexcept override; 24 | const char *GetShortSensorType() const noexcept override { return "remote"; } // TODO save the actual type 25 | 26 | private: 27 | CanAddress boardAddress; 28 | }; 29 | 30 | #endif 31 | 32 | #endif /* SRC_HEATING_SENSORS_REMOTESENSOR_H_ */ 33 | -------------------------------------------------------------------------------- /src/Heating/Sensors/RtdSensor31865.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RtdSensor31865.h 3 | * 4 | * Created on: 8 Jun 2017 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_HEATING_RTDSENSOR31865_H_ 9 | #define SRC_HEATING_RTDSENSOR31865_H_ 10 | 11 | #include "SpiTemperatureSensor.h" 12 | 13 | class RtdSensor31865 : public SpiTemperatureSensor 14 | { 15 | public: 16 | RtdSensor31865(unsigned int sensorNum) noexcept; 17 | GCodeResult Configure(GCodeBuffer& gb, const StringRef& reply, bool& changed) override THROWS(GCodeException); 18 | void Poll() noexcept override; 19 | const char *GetShortSensorType() const noexcept override { return TypeName; } 20 | 21 | static constexpr const char *TypeName = "rtdmax31865"; 22 | 23 | private: 24 | TemperatureError TryInitRtd() const noexcept; 25 | 26 | uint16_t rref; // reference resistor in ohms 27 | uint8_t cr0; 28 | }; 29 | 30 | #endif /* SRC_HEATING_RTDSENSOR31865_H_ */ 31 | -------------------------------------------------------------------------------- /src/Heating/Sensors/SensorWithPort.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * SensorWithPort.cpp 3 | * 4 | * Created on: 18 Jul 2019 5 | * Author: David 6 | */ 7 | 8 | #include "SensorWithPort.h" 9 | #include "GCodes/GCodeBuffer/GCodeBuffer.h" 10 | 11 | SensorWithPort::SensorWithPort(unsigned int sensorNum, const char *type) noexcept 12 | : TemperatureSensor(sensorNum, type) 13 | { 14 | } 15 | 16 | SensorWithPort::~SensorWithPort() noexcept 17 | { 18 | port.Release(); 19 | } 20 | 21 | // Try to configure the port. Return true if the port is valid at the end, else return false and set the error message in 'reply'. Set 'seen' if we saw the P parameter. 22 | bool SensorWithPort::ConfigurePort(GCodeBuffer& gb, const StringRef& reply, PinAccess access, bool& seen) 23 | { 24 | if (gb.Seen('P')) 25 | { 26 | seen = true; 27 | return port.AssignPort(gb, reply, PinUsedBy::sensor, access); 28 | } 29 | if (port.IsValid()) 30 | { 31 | return true; 32 | } 33 | reply.copy("Missing port name parameter"); 34 | return false; 35 | } 36 | 37 | // Copy the basic details to the reply buffer. This hides the version in the base class. 38 | void SensorWithPort::CopyBasicDetails(const StringRef& reply) const noexcept 39 | { 40 | reply.printf("Sensor %u", GetSensorNumber()); 41 | if (GetSensorName() != nullptr) 42 | { 43 | reply.catf(" (%s)", GetSensorName()); 44 | } 45 | reply.catf(" type %s using pin ", GetSensorType()); 46 | port.AppendPinName(reply); 47 | reply.catf(", reading %.1f, last error: %s", (double)GetStoredReading(), TemperatureErrorString(GetLastError())); 48 | } 49 | 50 | // End 51 | -------------------------------------------------------------------------------- /src/Heating/Sensors/SensorWithPort.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SensorWithPort.h 3 | * 4 | * Created on: 18 Jul 2019 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_HEATING_SENSORS_SENSORWITHPORT_H_ 9 | #define SRC_HEATING_SENSORS_SENSORWITHPORT_H_ 10 | 11 | #include "TemperatureSensor.h" 12 | 13 | class SensorWithPort : public TemperatureSensor 14 | { 15 | protected: 16 | SensorWithPort(unsigned int sensorNum, const char *type) noexcept; 17 | ~SensorWithPort() noexcept; 18 | 19 | // Try to configure the port 20 | bool ConfigurePort(GCodeBuffer& gb, const StringRef& reply, PinAccess access, bool& seen); 21 | 22 | // Copy the basic details to the reply buffer. This hides the version in the base class. 23 | void CopyBasicDetails(const StringRef& reply) const noexcept; 24 | 25 | IoPort port; 26 | }; 27 | 28 | #endif /* SRC_HEATING_SENSORS_SENSORWITHPORT_H_ */ 29 | -------------------------------------------------------------------------------- /src/Heating/Sensors/SpiTemperatureSensor.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * SpiTemperatureSensor.cpp 3 | * 4 | * Created on: 8 Jun 2017 5 | * Author: David 6 | */ 7 | 8 | #include "SpiTemperatureSensor.h" 9 | #include "Tasks.h" 10 | 11 | SpiTemperatureSensor::SpiTemperatureSensor(unsigned int sensorNum, const char *name, uint8_t spiMode, uint32_t clockFrequency) noexcept 12 | : SensorWithPort(sensorNum, name) 13 | { 14 | device.csPin = NoPin; 15 | device.csPolarity = false; // active low chip select 16 | device.spiMode = spiMode; 17 | device.clockFrequency = clockFrequency; 18 | #if defined(__LPC17xx__) 19 | device.sspChannel = TempSensorSSPChannel; // use SSP0 on LPC 20 | #endif 21 | lastTemperature = 0.0; 22 | lastResult = TemperatureError::notInitialised; 23 | } 24 | 25 | bool SpiTemperatureSensor::ConfigurePort(GCodeBuffer& gb, const StringRef& reply, bool& seen) 26 | { 27 | const bool ret = SensorWithPort::ConfigurePort(gb, reply, PinAccess::write1, seen); 28 | device.csPin = port.GetPin(); 29 | return ret; 30 | } 31 | 32 | void SpiTemperatureSensor::InitSpi() noexcept 33 | { 34 | sspi_master_init(&device, 8); 35 | lastReadingTime = millis(); 36 | } 37 | 38 | // Send and receive 1 to 8 bytes of data and return the result as a single 32-bit word 39 | TemperatureError SpiTemperatureSensor::DoSpiTransaction(const uint8_t dataOut[], size_t nbytes, uint32_t& rslt) const noexcept 40 | { 41 | uint8_t rawBytes[8]; 42 | spi_status_t sts; 43 | { 44 | MutexLocker lock(Tasks::GetSpiMutex(), 10); 45 | if (!lock) 46 | { 47 | return TemperatureError::busBusy; 48 | } 49 | 50 | sspi_master_setup_device(&device); 51 | delayMicroseconds(1); 52 | sspi_select_device(&device); 53 | delayMicroseconds(1); 54 | 55 | sts = sspi_transceive_packet(dataOut, rawBytes, nbytes); 56 | 57 | delayMicroseconds(1); 58 | sspi_deselect_device(&device); 59 | delayMicroseconds(1); 60 | } 61 | 62 | if (sts != SPI_OK) 63 | { 64 | return TemperatureError::timeout; 65 | } 66 | 67 | rslt = rawBytes[0]; 68 | for (size_t i = 1; i < nbytes; ++i) 69 | { 70 | rslt <<= 8; 71 | rslt |= rawBytes[i]; 72 | } 73 | 74 | return TemperatureError::success; 75 | } 76 | 77 | // End 78 | -------------------------------------------------------------------------------- /src/Heating/Sensors/SpiTemperatureSensor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SpiTemperatureSensor.h 3 | * 4 | * Created on: 8 Jun 2017 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_HEATING_SPITEMPERATURESENSOR_H_ 9 | #define SRC_HEATING_SPITEMPERATURESENSOR_H_ 10 | 11 | #include "SensorWithPort.h" 12 | #include "SharedSpi.h" // for sspi_device 13 | 14 | class SpiTemperatureSensor : public SensorWithPort 15 | { 16 | protected: 17 | SpiTemperatureSensor(unsigned int sensorNum, const char *name, uint8_t spiMode, uint32_t clockFrequency) noexcept; 18 | bool ConfigurePort(GCodeBuffer& gb, const StringRef& reply, bool& seen); 19 | void InitSpi() noexcept; 20 | TemperatureError DoSpiTransaction(const uint8_t dataOut[], size_t nbytes, uint32_t& rslt) const noexcept 21 | pre(nbytes <= 8); 22 | 23 | sspi_device device; 24 | uint32_t lastReadingTime; 25 | float lastTemperature; 26 | TemperatureError lastResult; 27 | }; 28 | 29 | #endif /* SRC_HEATING_SPITEMPERATURESENSOR_H_ */ 30 | -------------------------------------------------------------------------------- /src/Heating/Sensors/Thermistor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Thermistor.h 3 | * 4 | * Created on: 10 Nov 2016 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_HEATING_THERMISTOR_H_ 9 | #define SRC_HEATING_THERMISTOR_H_ 10 | 11 | #include "SensorWithPort.h" 12 | 13 | // The Steinhart-Hart equation for thermistor resistance is: 14 | // 1/T = A + B ln(R) + C [ln(R)]^3 15 | // 16 | // The simplified (beta) equation assumes C=0 and is: 17 | // 1/T = A + (1/Beta) ln(R) 18 | // 19 | // The parameters that can be configured in RRF are R25 (the resistance at 25C), Beta, and optionally C. 20 | 21 | class Thermistor : public SensorWithPort 22 | { 23 | public: 24 | Thermistor(unsigned int sensorNum, bool p_isPT1000) noexcept; // create an instance with default values 25 | GCodeResult Configure(GCodeBuffer& gb, const StringRef& reply, bool& changed) override THROWS(GCodeException); // configure the sensor from M305 parameters 26 | void Poll() noexcept override; 27 | const char *GetShortSensorType() const noexcept override { return (isPT1000) ? TypeNamePT1000 : TypeNameThermistor; } 28 | 29 | static constexpr const char *TypeNameThermistor = "thermistor"; 30 | static constexpr const char *TypeNamePT1000 = "pt1000"; 31 | 32 | private: 33 | // For the theory behind ADC oversampling, see http://www.atmel.com/Images/doc8003.pdf 34 | static constexpr unsigned int AdcOversampleBits = 2; // we use 2-bit oversampling 35 | 36 | void CalcDerivedParameters() noexcept; // calculate shA and shB 37 | 38 | // The following are configurable parameters 39 | float r25, beta, shC, seriesR; // parameters declared in the M305 command 40 | int8_t adcFilterChannel; 41 | bool isPT1000; // true if it is a PT1000 sensor, not a thermistor 42 | 43 | // Duet 3 VRef calibration doesn't work well on the MB6HC v0.6 or v1.0 so provide calibration adjustment 44 | #if !HAS_VREF_MONITOR || defined(DUET3) 45 | int8_t adcLowOffset, adcHighOffset; 46 | #endif 47 | 48 | // The following are derived from the configurable parameters 49 | float shA, shB; // derived parameters 50 | 51 | static constexpr int32_t OversampledAdcRange = 1u << (AdcBits + AdcOversampleBits); // The readings we pass in should be in range 0..(AdcRange - 1) 52 | }; 53 | 54 | #endif /* SRC_HEATING_THERMISTOR_H_ */ 55 | -------------------------------------------------------------------------------- /src/Heating/Sensors/ThermocoupleSensor31855.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ThermocoupleSensor31855.h 3 | * 4 | * Created on: 8 Jun 2017 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_HEATING_THERMOCOUPLESENSOR31855_H_ 9 | #define SRC_HEATING_THERMOCOUPLESENSOR31855_H_ 10 | 11 | #include "SpiTemperatureSensor.h" 12 | 13 | class ThermocoupleSensor31855 : public SpiTemperatureSensor 14 | { 15 | public: 16 | ThermocoupleSensor31855(unsigned int sensorNum) noexcept; 17 | GCodeResult Configure(GCodeBuffer& gb, const StringRef& reply, bool& changed) override THROWS(GCodeException); 18 | void Poll() noexcept override; 19 | const char *GetShortSensorType() const noexcept override { return TypeName; } 20 | 21 | static constexpr const char *TypeName = "thermocouplemax31855"; 22 | }; 23 | 24 | #endif /* SRC_HEATING_THERMOCOUPLESENSOR31855_H_ */ 25 | -------------------------------------------------------------------------------- /src/Heating/Sensors/ThermocoupleSensor31856.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ThermocoupleSensor31856.h 3 | * 4 | * Created on: 27 Jun 2017 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_HEATING_SENSORS_THERMOCOUPLESENSOR31856_H_ 9 | #define SRC_HEATING_SENSORS_THERMOCOUPLESENSOR31856_H_ 10 | 11 | #include "SpiTemperatureSensor.h" 12 | 13 | class ThermocoupleSensor31856 : public SpiTemperatureSensor 14 | { 15 | public: 16 | ThermocoupleSensor31856(unsigned int sensorNum) noexcept; 17 | GCodeResult Configure(GCodeBuffer& gb, const StringRef& reply, bool& changed) override THROWS(GCodeException); 18 | void Poll() noexcept override; 19 | const char *GetShortSensorType() const noexcept override { return TypeName; } 20 | 21 | static constexpr const char *TypeName = "thermocouplemax31856"; 22 | 23 | private: 24 | TemperatureError TryInitThermocouple() const noexcept; 25 | 26 | uint8_t cr0; 27 | uint8_t thermocoupleType; 28 | }; 29 | 30 | #endif /* SRC_HEATING_SENSORS_THERMOCOUPLESENSOR31856_H_ */ 31 | -------------------------------------------------------------------------------- /src/Heating/Sensors/TmcDriverTemperatureSensor.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * TmcDriverTemperatureSensor.cpp 3 | * 4 | * Created on: 8 Jun 2017 5 | * Author: David 6 | */ 7 | 8 | #include "TmcDriverTemperatureSensor.h" 9 | #include "Platform.h" 10 | #include "RepRap.h" 11 | 12 | #if HAS_SMART_DRIVERS 13 | 14 | TmcDriverTemperatureSensor::TmcDriverTemperatureSensor(unsigned int sensorNum, unsigned int chan) noexcept 15 | : TemperatureSensor(sensorNum, "Stepper driver temperature warnings"), channel(chan) 16 | { 17 | } 18 | 19 | const char *TmcDriverTemperatureSensor::GetShortSensorType() const noexcept 20 | { 21 | #ifdef DUET_NG 22 | return (channel == 1) ? DuexTypeShortName : PrimaryTypeName; 23 | #else 24 | return PrimaryTypeName; 25 | #endif 26 | } 27 | 28 | void TmcDriverTemperatureSensor::Poll() noexcept 29 | { 30 | SetResult(reprap.GetPlatform().GetTmcDriversTemperature(channel), TemperatureError::success); 31 | } 32 | 33 | #endif 34 | 35 | // End 36 | -------------------------------------------------------------------------------- /src/Heating/Sensors/TmcDriverTemperatureSensor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TmcDriverTemperatureSensor.h 3 | * 4 | * Created on: 8 Jun 2017 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_HEATING_SENSORS_TMCDRIVERTEMPERATURESENSOR_H_ 9 | #define SRC_HEATING_SENSORS_TMCDRIVERTEMPERATURESENSOR_H_ 10 | 11 | #include "TemperatureSensor.h" 12 | 13 | #if HAS_SMART_DRIVERS 14 | 15 | class TmcDriverTemperatureSensor : public TemperatureSensor 16 | { 17 | public: 18 | TmcDriverTemperatureSensor(unsigned int sensorNum, unsigned int chan) noexcept; 19 | 20 | int GetSmartDriversChannel() const noexcept override { return (int) channel; } // Get the smart drivers channel that this sensor monitors, or -1 if it doesn't 21 | void Poll() noexcept override; 22 | const char *GetShortSensorType() const noexcept override; 23 | 24 | static constexpr const char *PrimaryTypeName = "drivers"; 25 | #ifdef DUET_NG 26 | static constexpr const char *DuexTypeName = "drivers-duex"; 27 | static constexpr const char *DuexTypeShortName = "driversduex"; 28 | #endif 29 | 30 | private: 31 | unsigned int channel; 32 | }; 33 | 34 | #endif 35 | 36 | #endif /* SRC_HEATING_SENSORS_TMCDRIVERTEMPERATURESENSOR_H_ */ 37 | -------------------------------------------------------------------------------- /src/Heating/TemperatureError.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * TemperatureError.cpp 3 | * 4 | * Created on: 21 Apr 2016 5 | * Author: David 6 | */ 7 | 8 | #include "TemperatureError.h" 9 | 10 | const char* TemperatureErrorString(TemperatureError err) noexcept 11 | { 12 | switch(err) 13 | { 14 | case TemperatureError::success: return "success"; 15 | case TemperatureError::shortCircuit: return "short-circuit in sensor"; 16 | case TemperatureError::shortToVcc: return "sensor short to Vcc"; 17 | case TemperatureError::shortToGround: return "sensor short to ground"; 18 | case TemperatureError::openCircuit: return "sensor open circuit"; 19 | case TemperatureError::timeout: return "sensor timeout"; 20 | case TemperatureError::ioError: return "sensor I/O error"; 21 | case TemperatureError::hardwareError: return "sensor hardware error"; 22 | case TemperatureError::notReady: return "sensor not ready"; 23 | case TemperatureError::invalidOutputNumber: return "invalid additional sensor output"; 24 | case TemperatureError::busBusy: return "sensor bus busy"; 25 | case TemperatureError::badResponse: return "bad response from sensor"; 26 | case TemperatureError::unknownPort: return "unknown temperature port"; 27 | case TemperatureError::notInitialised: return "sensor not initialised"; 28 | case TemperatureError::unknownSensor: return "unknown sensor"; 29 | case TemperatureError::overOrUnderVoltage: return "sensor short to other wiring"; 30 | case TemperatureError::badVref: return "bad Vref"; 31 | case TemperatureError::badVssa: return "bad Vssa"; 32 | default: return "unknown temperature sense error"; 33 | } 34 | } 35 | 36 | // End 37 | -------------------------------------------------------------------------------- /src/Heating/TemperatureError.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TemperatureError.h 3 | * 4 | * Created on: 21 Apr 2016 5 | * Author: David 6 | */ 7 | 8 | #ifndef TEMPERATUREERROR_H_ 9 | #define TEMPERATUREERROR_H_ 10 | 11 | #include 12 | 13 | // Result codes returned by temperature sensor drivers 14 | enum class TemperatureError : uint8_t 15 | { 16 | success, 17 | shortCircuit, 18 | shortToVcc, 19 | shortToGround, 20 | openCircuit, 21 | timeout, 22 | ioError, 23 | hardwareError, 24 | notReady, 25 | invalidOutputNumber, 26 | busBusy, 27 | badResponse, 28 | unknownPort, 29 | notInitialised, 30 | unknownSensor, 31 | overOrUnderVoltage, 32 | badVref, 33 | badVssa 34 | }; 35 | 36 | const char* TemperatureErrorString(TemperatureError err) noexcept; 37 | 38 | #endif /* TEMPERATUREERROR_H_ */ 39 | -------------------------------------------------------------------------------- /src/LPC/BoardConfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Board Config 3 | * 4 | * Created on: 3 Feb 2019 5 | * Author: sdavi 6 | */ 7 | 8 | #ifndef BOARDCONFIG_H_ 9 | #define BOARDCONFIG_H_ 10 | 11 | #include "Core.h" 12 | #include "RepRapFirmware.h" 13 | #include "MessageType.h" 14 | #include "Storage/FileStore.h" 15 | #include "RepRap.h" 16 | 17 | 18 | enum configValueType{ 19 | cvPinType = 0, 20 | cvBoolType, 21 | cvUint8Type, 22 | cvUint16Type, 23 | cvUint32Type, 24 | cvFloatType, 25 | cvStringType, 26 | }; 27 | 28 | struct boardConfigEntry_t 29 | { 30 | const char* key; 31 | void *variable; 32 | const size_t *maxArrayEntries; 33 | configValueType type; 34 | }; 35 | 36 | 37 | class Platform; //fwd decl 38 | 39 | class BoardConfig { 40 | 41 | public: 42 | static void Init() noexcept; 43 | 44 | static void Diagnostics(MessageType mtype) noexcept; 45 | static Pin StringToPin(const char *strvalue) noexcept; 46 | static Pin LookupPin(char *strvalue) noexcept; 47 | 48 | 49 | private: 50 | BoardConfig() noexcept; 51 | static bool GetConfigKeys(FIL *configFile, const boardConfigEntry_t *boardConfigEntryArray, const size_t numConfigs) noexcept; 52 | static void SetValueFromString(configValueType type, void *variable, char *valuePtr) noexcept; 53 | static void PrintValue(MessageType mtype, configValueType configType, void *variable) noexcept; 54 | static void PrintPinArray(MessageType mtype, Pin arr[], uint16_t numEntries) noexcept; 55 | }; 56 | 57 | #endif /* BOARDCONFIG_H_ */ 58 | -------------------------------------------------------------------------------- /src/LPC/FatFS/integer.h: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------*/ 2 | /* Integer type definitions for FatFs module */ 3 | /*-------------------------------------------*/ 4 | 5 | #ifndef _INTEGER 6 | #define _INTEGER 7 | 8 | #ifdef _WIN32 /* FatFs development platform */ 9 | 10 | #include 11 | #include 12 | 13 | #else /* Embedded platform */ 14 | 15 | /* These types must be 16-bit, 32-bit or larger integer */ 16 | typedef int INT; 17 | typedef unsigned int UINT; 18 | 19 | /* These types must be 8-bit integer */ 20 | typedef char CHAR; 21 | typedef unsigned char UCHAR; 22 | typedef unsigned char BYTE; 23 | 24 | /* These types must be 16-bit integer */ 25 | typedef short SHORT; 26 | typedef unsigned short USHORT; 27 | typedef unsigned short WORD; 28 | typedef unsigned short WCHAR; 29 | 30 | /* These types must be 32-bit integer */ 31 | typedef long LONG; 32 | typedef unsigned long ULONG; 33 | typedef unsigned long DWORD; 34 | 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /src/LPC/LPCNetworking/RTOSPlusTCPEthernet/RTOSPlusTCPEthernetServerSocket.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * 4 | * Author: Stephen 5 | */ 6 | 7 | #ifndef SRC_NETWORKING_RTOSPlusTCPEthernetSERVERSOCKET_H_ 8 | #define SRC_NETWORKING_RTOSPlusTCPEthernetSERVERSOCKET_H_ 9 | 10 | #include "RepRapFirmware.h" 11 | #include "NetworkDefs.h" 12 | #include "Socket.h" 13 | 14 | #include 15 | #include "task.h" 16 | #include "FreeRTOS_IP.h" 17 | #include "FreeRTOS_Sockets.h" 18 | 19 | 20 | // Server socket 21 | class RTOSPlusTCPEthernetServerSocket 22 | { 23 | public: 24 | 25 | static RTOSPlusTCPEthernetServerSocket *Instance() noexcept; 26 | Socket_t GetServerSocket(Port serverPort, NetworkProtocol p) noexcept; 27 | void CloseServerSocket(NetworkProtocol p) noexcept; 28 | void CloseProtocol(NetworkProtocol p) noexcept; 29 | void CloseAllProtocols() noexcept; 30 | 31 | 32 | private: 33 | RTOSPlusTCPEthernetServerSocket() noexcept; 34 | 35 | Socket_t protocolServerSockets[NumProtocols]; // Server for each Protocol (assuming socket reuse is false (default in +tcp)) 36 | static RTOSPlusTCPEthernetServerSocket *serverSocketInstance; 37 | }; 38 | 39 | #endif /* SRC_NETWORKING_RTOSPlusTCPEthernetSERVERSOCKET_H_ */ 40 | -------------------------------------------------------------------------------- /src/LPC/LPCNetworking/RTOSPlusTCPEthernet/RTOSPlusTCPEthernetSocket.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Socket.h 3 | * 4 | * Created on: 25 Dec 2016 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_NETWORKING_RTOSPlusTCPEthernetSOCKET_H_ 9 | #define SRC_NETWORKING_RTOSPlusTCPEthernetSOCKET_H_ 10 | 11 | #include "RepRapFirmware.h" 12 | #include "NetworkDefs.h" 13 | #include "Socket.h" 14 | 15 | #include 16 | #include "task.h" 17 | #include "FreeRTOS_IP.h" 18 | #include "FreeRTOS_Sockets.h" 19 | 20 | #include "MessageType.h" 21 | 22 | // Socket structure that we use to track TCP connections 23 | class RTOSPlusTCPEthernetSocket : public Socket 24 | { 25 | public: 26 | RTOSPlusTCPEthernetSocket(NetworkInterface *iface) noexcept; 27 | void Init(SocketNumber s, Port serverPort, NetworkProtocol p) noexcept; 28 | 29 | void Poll() noexcept override; 30 | void Close() noexcept override; 31 | void Terminate() noexcept override; 32 | void TerminateAndDisable() noexcept override; 33 | bool ReadChar(char& c) noexcept override; 34 | bool ReadBuffer(const uint8_t *&buffer, size_t &len) noexcept override; 35 | void Taken(size_t len) noexcept override; 36 | bool CanRead() const noexcept override; 37 | bool CanSend() const noexcept override; 38 | size_t Send(const uint8_t *data, size_t length) noexcept override; 39 | void Send() noexcept override; 40 | void Diagnostics(MessageType mt) const noexcept; 41 | 42 | private: 43 | void ReInit() noexcept; 44 | void ReceiveData() noexcept; 45 | void DiscardReceivedData() noexcept; 46 | 47 | NetworkBuffer *receivedData; // List of buffers holding received data 48 | uint32_t whenConnected; 49 | bool closingTimeoutStarted; 50 | SocketNumber socketNum; // The RTOSPlusTCPEthernet socket number we are using 51 | 52 | //TCP+ 53 | Socket_t xListeningSocket; // server socket 54 | Socket_t xConnectedSocket; //connected client socket 55 | bool CheckSocketError(BaseType_t val) noexcept; 56 | 57 | }; 58 | 59 | #endif /* SRC_NETWORKING_RTOSPlusTCPEthernetSOCKET_H_ */ 60 | -------------------------------------------------------------------------------- /src/LPC/MCP4461/MCP4461.h: -------------------------------------------------------------------------------- 1 | #ifndef MCP4461_H 2 | #define MCP4461_H 3 | 4 | #include 5 | 6 | #define DEFAULT_ADDRESS 0x2C //With A0 and A1 grounded 7 | #define DEFAULT_WIPER_VALUE 0x80 //Default to the wipers in midrange 8 | 9 | // meory addresses (all shifted 4 bits left) 10 | //For all the Wipers 0x100 = Full scale, 0x80 = mid scale, 0x0 = Zero scale 11 | #define MCP4461_VW0 0x00 12 | #define MCP4461_VW1 0x10 13 | #define MCP4461_NVW0 0x20 14 | #define MCP4461_NVW1 0x30 15 | //TCON0: D8: Reserved D7:R1HW D6: R1A D5:R1W D4:R1B D3:R0HW D2:R0A D1:R0W D0: R0B 16 | #define MCP4461_TCON0 0x40 17 | //STATUS: D8:D7: Reserved D6: WL3 D5:WL2 D4:EEWA D3:WL1 D2:WL0 D1:Reserved D0: WP 18 | #define MCP4461_STATUS 0x50 19 | #define MCP4461_VW2 0x60 20 | #define MCP4461_VW3 0x70 21 | #define MCP4461_NVW2 0x80 22 | #define MCP4461_NVW3 0x90 23 | //TCON0: D8: Reserved D7:R3HW D6: R3A D5:R3W D4:R3B D3:R2HW D2:R2A D1:R2W D0: R2B 24 | #define MCP4461_TCON1 0xA0 25 | 26 | //control commands 27 | #define MCP4461_WRITE 0x0 28 | #define MCP4461_INCREMENT 0x4 //01 left shift by 2 29 | #define MCP4461_DECREMENT 0x8 //10 left shift by 2 30 | #define MCP4461_READ 0xC //11 left shift by 2 31 | 32 | class MCP4461 33 | { 34 | public: 35 | MCP4461() noexcept; 36 | void begin() noexcept; 37 | void setMCP4461Address(uint8_t) noexcept; 38 | void setVolatileWiper(uint8_t, uint16_t) noexcept; 39 | void setVolatileWipers(uint16_t) noexcept; 40 | void toggleWiper(uint8_t) noexcept; //NOT YET IMPLEMENTED 41 | uint16_t getVolatileWiper(uint8_t) noexcept; 42 | uint16_t getStatus() noexcept; 43 | 44 | private: 45 | uint8_t _mcp4461_address; 46 | uint8_t _wiper; 47 | uint8_t _value; 48 | }; 49 | 50 | #endif //MCP4461_H 51 | -------------------------------------------------------------------------------- /src/LPC/Microstepping.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Alligator Microstepping Settings 3 | * 4 | * Created on: 15 May 2017 5 | * Author: Marco Antonini 6 | */ 7 | 8 | #include "Microstepping.h" 9 | #include "RepRapFirmware.h" 10 | 11 | 12 | //*************************************************************************************************** 13 | // LPC Microstepping static class 14 | 15 | 16 | uint8_t microstepping[ NumDirectDrivers ]; 17 | 18 | void Microstepping::Init() noexcept 19 | { 20 | //nothing to do 21 | 22 | } 23 | 24 | bool Microstepping::Set(uint8_t drive, uint8_t value) noexcept 25 | { 26 | 27 | // Do not exceed the maximum value 28 | if ( drive >= (NumDirectDrivers) ) 29 | { 30 | return false; 31 | } 32 | if (value !=8 && value != 16 && value != 32 && value != 128 && value != 256) 33 | { 34 | return false; 35 | } 36 | 37 | microstepping[drive] = value; 38 | 39 | return true; 40 | } 41 | 42 | uint8_t Microstepping::Read( uint8_t drive ) noexcept 43 | { 44 | 45 | // Do not exceed the maximum value 46 | if ( drive < (NumDirectDrivers) ) 47 | { 48 | return ( microstepping[drive] ); 49 | } 50 | else 51 | { 52 | return 16; 53 | } 54 | } 55 | 56 | // End 57 | -------------------------------------------------------------------------------- /src/LPC/Microstepping.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Alligator Microstepping Settings 3 | * 4 | * Created on: 15 May 2017 5 | * Author: Marco Antonini 6 | */ 7 | 8 | #ifndef ALLIGATOR_MICROSTEPPING_H_ 9 | #define ALLIGATOR_MICROSTEPPING_H_ 10 | 11 | #include 12 | #include "Core.h" 13 | 14 | 15 | class Microstepping { 16 | 17 | public: 18 | 19 | static void Init() noexcept; 20 | static bool Set(uint8_t drive, uint8_t value) noexcept; 21 | static uint8_t Read( uint8_t drive ) noexcept; 22 | 23 | private: 24 | 25 | Microstepping() noexcept { }; 26 | 27 | }; 28 | #endif /* ALLIGATOR_MICROSTEPPING_H_ */ 29 | -------------------------------------------------------------------------------- /src/LPC/SoftwareResetData.h: -------------------------------------------------------------------------------- 1 | //SD 2 | 3 | #ifndef SOFTWARERESETDATA_H_ 4 | #define SOFTWARERESETDATA_H_ 5 | 6 | #include "Core.h" 7 | #include "iap.h" 8 | 9 | 10 | bool LPC_IsSoftwareResetDataSlotVacant(uint8_t slot) noexcept; 11 | uint32_t *LPC_GetSoftwareResetDataSlotPtr(uint8_t slot) noexcept; 12 | void LPC_ReadSoftwareResetDataSlot(uint8_t slot, void *data, uint32_t dataLength) noexcept; 13 | bool LPC_EraseSoftwareResetDataSlots() noexcept; 14 | bool LPC_WriteSoftwareResetData(uint8_t slot, const void *data, uint32_t dataLength) noexcept; 15 | 16 | //Compatibility 17 | inline void EraseAndReset() noexcept {}; 18 | 19 | 20 | #endif /* SOFTWARERESETDATA_H_ */ 21 | -------------------------------------------------------------------------------- /src/Libraries/.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | -------------------------------------------------------------------------------- /src/Libraries/Fatfs/integer.h: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------*/ 2 | /* Integer type definitions for FatFs module */ 3 | /*-------------------------------------------*/ 4 | 5 | #ifndef _INTEGER 6 | #define _INTEGER 7 | 8 | #ifdef _WIN32 /* FatFs development platform */ 9 | 10 | #include 11 | #include 12 | 13 | #else /* Embedded platform */ 14 | 15 | /* These types must be 16-bit, 32-bit or larger integer */ 16 | typedef int INT; 17 | typedef unsigned int UINT; 18 | 19 | /* These types must be 8-bit integer */ 20 | typedef char CHAR; 21 | typedef unsigned char UCHAR; 22 | typedef unsigned char BYTE; 23 | 24 | /* These types must be 16-bit integer */ 25 | typedef short SHORT; 26 | typedef unsigned short USHORT; 27 | typedef unsigned short WORD; 28 | typedef unsigned short WCHAR; 29 | 30 | /* These types must be 32-bit integer */ 31 | typedef long LONG; 32 | typedef unsigned long ULONG; 33 | typedef unsigned long DWORD; 34 | 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /src/Libraries/sha1/sha1.h: -------------------------------------------------------------------------------- 1 | /* 2 | * sha1.h 3 | * 4 | * Copyright (C) 1998, 2009 5 | * Paul E. Jones 6 | * All Rights Reserved 7 | * 8 | ***************************************************************************** 9 | * $Id: sha1.h 12 2009-06-22 19:34:25Z paulej $ 10 | ***************************************************************************** 11 | * 12 | * Description: 13 | * This class implements the Secure Hashing Standard as defined 14 | * in FIPS PUB 180-1 published April 17, 1995. 15 | * 16 | * Many of the variable names in the SHA1Context, especially the 17 | * single character names, were used because those were the names 18 | * used in the publication. 19 | * 20 | * Please read the file sha1.c for more information. 21 | * 22 | * Updated to use stdint.h and be CPP compatible. 23 | */ 24 | 25 | #ifndef _SHA1_H_ 26 | #define _SHA1_H_ 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | #include 32 | #include 33 | 34 | /* 35 | * This structure will hold context information for the hashing 36 | * operation 37 | */ 38 | typedef struct SHA1Context 39 | { 40 | uint32_t Message_Digest[5]; /* Message Digest (output) */ 41 | 42 | uint32_t Length_Low; /* Message length in bits */ 43 | uint32_t Length_High; /* Message length in bits */ 44 | 45 | uint8_t Message_Block[64]; /* 512-bit message blocks */ 46 | int32_t Message_Block_Index; /* Index into message block array */ 47 | 48 | bool Computed; /* Is the digest computed? */ 49 | bool Corrupted; /* Is the message digest corruped? */ 50 | } SHA1Context; 51 | 52 | /* 53 | * Function Prototypes 54 | */ 55 | void SHA1Reset(SHA1Context* context) noexcept; 56 | bool SHA1Result(SHA1Context* context) noexcept; 57 | void SHA1Input(SHA1Context* context, const uint8_t* message_array, uint32_t length) noexcept; 58 | 59 | #ifdef __cplusplus 60 | } 61 | #endif 62 | #endif 63 | -------------------------------------------------------------------------------- /src/Logger.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Logger.h 3 | * 4 | * Created on: 17 Sep 2017 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_LOGGER_H_ 9 | #define SRC_LOGGER_H_ 10 | 11 | #include "RepRapFirmware.h" 12 | 13 | #if HAS_MASS_STORAGE 14 | 15 | #include 16 | #include "Storage/FileData.h" 17 | 18 | class OutputBuffer; 19 | 20 | class Logger 21 | { 22 | public: 23 | Logger() noexcept; 24 | 25 | void Start(time_t time, const StringRef& file) noexcept; 26 | void Stop(time_t time) noexcept; 27 | void LogMessage(time_t time, const char *message) noexcept; 28 | void LogMessage(time_t time, OutputBuffer *buf) noexcept; 29 | void Flush(bool forced) noexcept; 30 | bool IsActive() const noexcept { return logFile.IsLive(); } 31 | const char *GetFileName() const noexcept { return (IsActive()) ? logFileName.c_str() : nullptr; } 32 | 33 | private: 34 | bool WriteDateTime(time_t time) noexcept; 35 | void InternalLogMessage(time_t time, const char *message) noexcept; 36 | 37 | String logFileName; 38 | FileData logFile; 39 | uint32_t lastFlushTime; 40 | FilePosition lastFlushFileSize; 41 | bool dirty; 42 | bool inLogger; 43 | }; 44 | 45 | #endif 46 | 47 | #endif /* SRC_LOGGER_H_ */ 48 | -------------------------------------------------------------------------------- /src/Memory usage.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdavi/RepRapFirmware/374100d1498cf62eab9f571e048a7358b575f994/src/Memory usage.ods -------------------------------------------------------------------------------- /src/Movement/HeightControl/HeightController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * HeightController.h 3 | * 4 | * Created on: 18 Apr 2019 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_MOVEMENT_HEIGHTCONTROL_HEIGHTCONTROLLER_H_ 9 | #define SRC_MOVEMENT_HEIGHTCONTROL_HEIGHTCONTROLLER_H_ 10 | 11 | #include "RepRapFirmware.h" 12 | #undef array 13 | 14 | #if SUPPORT_ASYNC_MOVES 15 | 16 | #include "GCodes/GCodeResult.h" 17 | #include 18 | 19 | class HeightController 20 | { 21 | public: 22 | HeightController() noexcept; 23 | 24 | GCodeResult Configure(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeException); 25 | GCodeResult StartHeightFollowing(GCodeBuffer& gb, const StringRef& reply) noexcept; // Start/stop height following 26 | void Stop() noexcept; // stop height following mode 27 | 28 | [[noreturn]] void RunTask() noexcept; 29 | 30 | private: 31 | void CalcDerivedValues() noexcept; 32 | 33 | static constexpr unsigned int HeightControllerTaskStackWords = 100; 34 | static constexpr uint32_t DefaultSampleInterval = 200; 35 | 36 | Task *heightControllerTask; 37 | int sensorNumber; // which sensor, normally a virtual heater, or -1 if not configured 38 | uint32_t sampleInterval; // in milliseconds 39 | uint32_t lastWakeTime; 40 | float setPoint; // the sensor output we are aiming for 41 | float lastReading; // the last reading we took from the sensor 42 | float pidP; 43 | float configuredPidI, configuredPidD; // the PID parameters 44 | float actualPidI, actualPidD; 45 | float iAccumulator; // the integral PID component 46 | float zMin, zMax; // the control limits 47 | float currentZ; 48 | float startSpeed; 49 | float maxSpeed; 50 | float acceleration; 51 | float maxZAdjustmentPerSample; // how much Z adjustment is possible in one sample period 52 | 53 | enum class PidState : uint8_t 54 | { 55 | stopped, 56 | starting, 57 | running 58 | }; 59 | 60 | volatile PidState state; // volatile because it is accessed by more than one task 61 | bool lastReadingOk; 62 | }; 63 | 64 | #endif 65 | 66 | #endif /* SRC_MOVEMENT_HEIGHTCONTROL_HEIGHTCONTROLLER_H_ */ 67 | -------------------------------------------------------------------------------- /src/Movement/Kinematics/ZLeadscrewKinematics.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ZLeadscrewKinematics.h 3 | * 4 | * Created on: 8 Jul 2017 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_MOVEMENT_KINEMATICS_ZLEADSCREWKINEMATICS_H_ 9 | #define SRC_MOVEMENT_KINEMATICS_ZLEADSCREWKINEMATICS_H_ 10 | 11 | #include "Kinematics.h" 12 | 13 | // This is used as the base class for any kinematic that supports auto or manual bed levelling (as distinct from bed compensation) 14 | // using leadscrews or bed adjusting screws. 15 | class ZLeadscrewKinematics : public Kinematics 16 | { 17 | public: 18 | ZLeadscrewKinematics(KinematicsType k) noexcept; 19 | ZLeadscrewKinematics(KinematicsType t, float segsPerSecond, float minSegLength, bool doUseRawG0) noexcept; 20 | 21 | bool Configure(unsigned int mCode, GCodeBuffer& gb, const StringRef& reply, bool& error) THROWS(GCodeException) override; 22 | bool SupportsAutoCalibration() const noexcept override; 23 | bool DoAutoCalibration(size_t numFactors, const RandomProbePointSet& probePoints, const StringRef& reply) noexcept override; 24 | #if HAS_MASS_STORAGE 25 | bool WriteResumeSettings(FileStore *f) const noexcept override; 26 | #endif 27 | 28 | protected: 29 | DECLARE_OBJECT_MODEL 30 | OBJECT_MODEL_ARRAY(screwX) 31 | OBJECT_MODEL_ARRAY(screwY) 32 | OBJECT_MODEL_ARRAY(lastCorrections) 33 | 34 | private: 35 | void AppendCorrections(const floatc_t corrections[], const StringRef& reply) const noexcept; 36 | 37 | static const unsigned int MaxLeadscrews = 8; // some Folgertech FT5 printers have 8 bed adjusting screws 38 | 39 | unsigned int numLeadscrews; 40 | float leadscrewX[MaxLeadscrews], leadscrewY[MaxLeadscrews]; 41 | float correctionFactor; 42 | float maxCorrection; 43 | float screwPitch; 44 | float lastCorrections[MaxLeadscrews]; 45 | }; 46 | 47 | #endif /* SRC_MOVEMENT_KINEMATICS_ZLEADSCREWKINEMATICS_H_ */ 48 | -------------------------------------------------------------------------------- /src/Movement/RawMove.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * RawMove.cpp 3 | * 4 | * Created on: 18 Apr 2019 5 | * Author: David 6 | */ 7 | 8 | #include "RawMove.h" 9 | 10 | // Set up some default values in the move buffer for special moves, e.g. for Z probing and firmware retraction 11 | void RawMove::SetDefaults(size_t firstDriveToZero) noexcept 12 | { 13 | moveType = 0; 14 | isCoordinated = false; 15 | applyM220M221 = false; 16 | usingStandardFeedrate = false; 17 | usePressureAdvance = false; 18 | checkEndstops = false; 19 | reduceAcceleration = false; 20 | hasExtrusion = false; 21 | filePos = noFilePosition; 22 | tool = nullptr; 23 | for (size_t drive = firstDriveToZero; drive < MaxAxesPlusExtruders; ++drive) 24 | { 25 | coords[drive] = 0.0; // clear extrusion 26 | } 27 | } 28 | 29 | #if SUPPORT_ASYNC_MOVES 30 | 31 | void AsyncMove::SetDefaults() noexcept 32 | { 33 | for (float& f : movements) 34 | { 35 | f = 0.0; // clear extrusion 36 | } 37 | startSpeed = endSpeed = 0.0; 38 | } 39 | 40 | #endif 41 | 42 | // End 43 | -------------------------------------------------------------------------------- /src/Movement/StepperDrivers/DriverMode.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * DriverMode.cpp 3 | * 4 | * Created on: 27 Apr 2018 5 | * Author: David 6 | */ 7 | 8 | #include 9 | #include "DriverMode.h" 10 | 11 | // This table must be in the same order as enum DriverMode 12 | static const char * const DriverModeStrings[] = 13 | { 14 | "constant off-time", 15 | "random off-time", 16 | "spreadCycle", 17 | "stealthChop", 18 | "unknown" 19 | }; 20 | 21 | static_assert(ARRAY_SIZE(DriverModeStrings) == (unsigned int)DriverMode::unknown + 1, "bad driver mode string table"); 22 | 23 | const char* TranslateDriverMode(unsigned int mode) noexcept 24 | { 25 | const unsigned int imode = min(mode, (unsigned int)DriverMode::unknown); 26 | return DriverModeStrings[imode]; 27 | } 28 | 29 | // End 30 | -------------------------------------------------------------------------------- /src/Movement/StepperDrivers/DriverMode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * DriverModes.h 3 | * 4 | * Created on: 27 Apr 2018 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_MOVEMENT_STEPPERDRIVERS_DRIVERMODE_H_ 9 | #define SRC_MOVEMENT_STEPPERDRIVERS_DRIVERMODE_H_ 10 | 11 | enum class DriverMode : unsigned int 12 | { 13 | constantOffTime = 0, 14 | randomOffTime, 15 | spreadCycle, 16 | stealthChop, // includes stealthChop2 17 | unknown // must be last! 18 | }; 19 | 20 | const char* TranslateDriverMode(unsigned int mode) noexcept; 21 | 22 | inline const char* TranslateDriverMode(DriverMode mode) noexcept 23 | { 24 | return TranslateDriverMode((unsigned int)mode); 25 | } 26 | 27 | // Register codes used to implement M569 command parameters. 28 | // This common set is used for all smart drivers. Not all are complete registers, some are just parts of registers. 29 | 30 | enum class SmartDriverRegister : unsigned int 31 | { 32 | toff, 33 | tblank, 34 | hstart, 35 | hend, 36 | hdec, 37 | chopperControl, 38 | coolStep, 39 | tpwmthrs, 40 | thigh, 41 | mstepPos, 42 | pwmScale 43 | }; 44 | 45 | #endif /* SRC_MOVEMENT_STEPPERDRIVERS_DRIVERMODE_H_ */ 46 | -------------------------------------------------------------------------------- /src/Movement/StepperDrivers/TMC2660.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdavi/RepRapFirmware/374100d1498cf62eab9f571e048a7358b575f994/src/Movement/StepperDrivers/TMC2660.cpp -------------------------------------------------------------------------------- /src/Movement/StraightProbeSettings.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * StraightProbeSettings.cpp 3 | * 4 | * Created on: 4 Oct 2019 5 | * Author: manuel 6 | */ 7 | 8 | #include "StraightProbeSettings.h" 9 | #include "RepRap.h" 10 | 11 | StraightProbeSettings::StraightProbeSettings() noexcept 12 | { 13 | Reset(); 14 | } 15 | 16 | void StraightProbeSettings::Reset() noexcept 17 | { 18 | movingAxes = AxesBitmap(); 19 | type = StraightProbeType::unset; 20 | for (size_t axis = 0; axis < MaxAxes; ++axis) 21 | { 22 | target[axis] = 0; 23 | } 24 | } 25 | 26 | void StraightProbeSettings::SetTarget(const float coords[MaxAxes]) noexcept 27 | { 28 | for (size_t axis = 0; axis < MaxAxes; ++axis) 29 | { 30 | target[axis] = coords[axis]; 31 | } 32 | } 33 | 34 | void StraightProbeSettings::SetCoordsToTarget(float coords[MaxAxes]) const noexcept 35 | { 36 | for (size_t axis = 0; axis < MaxAxes; ++axis) 37 | { 38 | coords[axis] = target[axis]; 39 | } 40 | } 41 | 42 | // End 43 | -------------------------------------------------------------------------------- /src/Networking/ESP8266WiFi/WiFiSocket.h: -------------------------------------------------------------------------------- 1 | /* 2 | * WiFiSocket.h 3 | * 4 | * Created on: 22 Apr 2017 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_NETWORKING_WIFISOCKET_H_ 9 | #define SRC_NETWORKING_WIFISOCKET_H_ 10 | 11 | #include "RepRapFirmware.h" 12 | #include "Networking/NetworkDefs.h" 13 | #include "Networking/Socket.h" 14 | 15 | 16 | class WiFiInterface; 17 | 18 | class WiFiSocket : public Socket 19 | { 20 | public: 21 | WiFiSocket(NetworkInterface *iface) noexcept; 22 | void Init(SocketNumber n) noexcept; 23 | int State() const noexcept { return (int)state; } // used only for reporting debug info, hence the 'int' return 24 | void Poll() noexcept; 25 | void Close() noexcept; 26 | bool IsClosing() const noexcept { return (state == SocketState::closing); } 27 | void Terminate() noexcept; 28 | void TerminateAndDisable() noexcept { Terminate(); } 29 | bool ReadChar(char& c) noexcept; 30 | bool ReadBuffer(const uint8_t *&buffer, size_t &len) noexcept; 31 | void Taken(size_t len) noexcept; 32 | bool CanRead() const noexcept; 33 | bool CanSend() const noexcept; 34 | size_t Send(const uint8_t *data, size_t length) noexcept; 35 | void Send() noexcept; 36 | void SetNeedsPolling() noexcept { needsPolling = true; } 37 | bool NeedsPolling() const noexcept; 38 | 39 | private: 40 | enum class SocketState : uint8_t 41 | { 42 | inactive, 43 | waitingForResponder, 44 | connected, 45 | clientDisconnecting, 46 | closing, 47 | broken 48 | }; 49 | 50 | WiFiInterface *GetInterface() const noexcept; 51 | void ReceiveData(uint16_t bytesAvailable) noexcept; 52 | void DiscardReceivedData() noexcept; 53 | 54 | NetworkBuffer *receivedData; // List of buffers holding received data 55 | uint32_t whenConnected; 56 | uint16_t txBufferSpace; // How much free transmit buffer space the WiFi mofule reported 57 | SocketNumber socketNum; // The WiFi socket number we are using 58 | SocketState state; 59 | bool needsPolling; 60 | }; 61 | 62 | #endif /* SRC_NETWORKING_WIFISOCKET_H_ */ 63 | -------------------------------------------------------------------------------- /src/Networking/FirmwareUpdater.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FirmwareUpdater.h 3 | * 4 | * Created on: 21 May 2016 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_NETWORKING_FIRMWAREUPDATER_H_ 9 | #define SRC_NETWORKING_FIRMWAREUPDATER_H_ 10 | 11 | #include "RepRapFirmware.h" 12 | 13 | namespace FirmwareUpdater 14 | { 15 | bool CheckFirmwareUpdatePrerequisites(uint8_t moduleMap, const StringRef& reply) noexcept; 16 | bool IsReady() noexcept; 17 | void UpdateModule(unsigned int module) noexcept; 18 | } 19 | 20 | #endif /* SRC_NETWORKING_FIRMWAREUPDATER_H_ */ 21 | -------------------------------------------------------------------------------- /src/Networking/FtpResponder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FtpResponder.h 3 | * 4 | * Created on: 14 Apr 2017 5 | * Authors: David and Christian 6 | */ 7 | 8 | #ifndef SRC_NETWORKING_FTPRESPONDER_H_ 9 | #define SRC_NETWORKING_FTPRESPONDER_H_ 10 | 11 | #include "UploadingNetworkResponder.h" 12 | 13 | class FtpResponder : public UploadingNetworkResponder 14 | { 15 | public: 16 | FtpResponder(NetworkResponder *n) noexcept; 17 | 18 | bool Spin() noexcept override; // do some work, returning true if we did anything significant 19 | bool Accept(Socket *s, NetworkProtocol protocol) noexcept override; // ask the responder to accept this connection, returns true if it did 20 | void Terminate(NetworkProtocol protocol, NetworkInterface *interface) noexcept override; // terminate the responder if it is serving the specified protocol on the specified interface 21 | 22 | void Diagnostics(MessageType mtype) const noexcept override; 23 | 24 | static void InitStatic() noexcept; 25 | static void Disable() noexcept; 26 | 27 | protected: 28 | void ConnectionLost() noexcept override; 29 | void SendData() noexcept override; 30 | void SendPassiveData() noexcept; 31 | void DoUpload() noexcept; 32 | bool ReadData() noexcept; 33 | void CharFromClient(char c) noexcept; 34 | void ProcessLine() noexcept; 35 | const char *GetParameter(const char *after) const noexcept; // return the parameter followed by whitespaces after a command 36 | void ChangeDirectory(const char *newDirectory) noexcept; 37 | void CloseDataPort() noexcept; 38 | 39 | static const size_t ftpMessageLength = 128; // maximum line length for incoming FTP commands 40 | static const uint32_t ftpPasvPortTimeout = 10000; // maximum time to wait for an FTP data connection in milliseconds 41 | 42 | Socket *dataSocket; 43 | Port passivePort; 44 | uint32_t passivePortOpenTime; 45 | OutputBuffer *dataBuf; 46 | 47 | bool sendError; 48 | bool haveCompleteLine; 49 | bool haveFileToMove; 50 | char clientMessage[ftpMessageLength]; 51 | size_t clientPointer; 52 | 53 | String currentDirectory; 54 | }; 55 | 56 | #endif /* SRC_NETWORKING_FTPRESPONDER_H_ */ 57 | -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/Lwip/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.7) 2 | 3 | project(lwIP) 4 | 5 | set(LWIP_DIR ${CMAKE_CURRENT_SOURCE_DIR}) 6 | include(src/Filelists.cmake) 7 | 8 | # Package generation 9 | set(CPACK_SOURCE_GENERATOR "ZIP") 10 | set(CPACK_SOURCE_PACKAGE_DESCRIPTION_SUMMARY "lwIP lightweight IP stack") 11 | set(CPACK_PACKAGE_VERSION_MAJOR "${LWIP_VERSION_MAJOR}") 12 | set(CPACK_PACKAGE_VERSION_MINOR "${LWIP_VERSION_MINOR}") 13 | set(CPACK_PACKAGE_VERSION_PATCH "${LWIP_VERSION_REVISION}") 14 | set(CPACK_SOURCE_IGNORE_FILES "/build/;${CPACK_SOURCE_IGNORE_FILES};.git") 15 | set(CPACK_SOURCE_PACKAGE_FILE_NAME "lwip-${LWIP_VERSION_MAJOR}.${LWIP_VERSION_MINOR}.${LWIP_VERSION_REVISION}") 16 | include(CPack) 17 | 18 | # Target for package generation 19 | add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source) 20 | add_dependencies(dist lwipdocs) 21 | -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/Lwip/COPYING: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001, 2002 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/Lwip/FEATURES: -------------------------------------------------------------------------------- 1 | lwIP is a small independent implementation of the TCP/IP protocol suite targeted at embedded systems. 2 | 3 | The focus of the lwIP TCP/IP implementation is to reduce resource usage while still having a full scale TCP. This makes lwIP suitable for use in embedded systems with tens of kilobytes of free RAM and room for around 40 kilobytes of code ROM. 4 | 5 | Main features include: 6 | - Protocols: IP, IPv6, ICMP, ND, MLD, UDP, TCP, IGMP, ARP, PPPoS, PPPoE, 6LowPAN (via IEEE 802.15.4, BLE or ZEP; since v2.1.0) 7 | - DHCP client, stateless DHCPv6 (since v2.1.0), DNS client (incl. mDNS hostname resolver), AutoIP/APIPA (Zeroconf), SNMP agent (v1, v2c, v3 (since v2.1.0), private MIB support & MIB compiler) 8 | - APIs: specialized APIs for enhanced performance & zero copy, optional Berkeley-alike socket API 9 | - Extended features: IP forwarding over multiple network interfaces 10 | - Extended TCP features: congestion control, RTT estimation and fast recovery/fast retransmit, sending SACKs (since v2.1.0), "altcp": nearly transparent TLS for any tcp pcb (since v2.1.0) 11 | - Addon applications: HTTP server (HTTPS via altcp), HTTP(S) client (since v2.1.0), SNTP client, SMTP client (SMTPS via altcp), ping, NetBIOS nameserver, mDNS responder, MQTT client (TLS support since v2.1.0), TFTP server, iPerf2 counterpart 12 | -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/Lwip/FILES: -------------------------------------------------------------------------------- 1 | src/ - The source code for the lwIP TCP/IP stack. 2 | doc/ - The documentation for lwIP. 3 | test/ - Some code to test whether the sources do what they should. 4 | 5 | See also the FILES file in each subdirectory. 6 | -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/Lwip/doc/FILES: -------------------------------------------------------------------------------- 1 | doxygen/ - Configuration files and scripts to create the lwIP doxygen source 2 | documentation (found at http://www.nongnu.org/lwip/) 3 | 4 | savannah.txt - How to obtain the current development source code. 5 | contrib.txt - How to contribute to lwIP as a developer. 6 | rawapi.txt - The documentation for the core API of lwIP. 7 | Also provides an overview about the other APIs and multithreading. 8 | sys_arch.txt - The documentation for a system abstraction layer of lwIP. 9 | ppp.txt - Documentation of the PPP interface for lwIP. 10 | -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/Lwip/doc/ZeroCopyRx.c: -------------------------------------------------------------------------------- 1 | typedef struct my_custom_pbuf 2 | { 3 | struct pbuf_custom p; 4 | void* dma_descriptor; 5 | } my_custom_pbuf_t; 6 | 7 | LWIP_MEMPOOL_DECLARE(RX_POOL, 10, sizeof(my_custom_pbuf_t), "Zero-copy RX PBUF pool"); 8 | 9 | void my_pbuf_free_custom(void* p) 10 | { 11 | SYS_ARCH_DECL_PROTECT(old_level); 12 | 13 | my_custom_pbuf_t* my_puf = (my_custom_pbuf_t*)p; 14 | 15 | // invalidate data cache here - lwIP and/or application may have written into buffer! 16 | // (invalidate is faster than flushing, and noone needs the correct data in the buffer) 17 | invalidate_cpu_cache(p->payload, p->tot_len); 18 | 19 | SYS_ARCH_PROTECT(old_level); 20 | free_rx_dma_descriptor(my_pbuf->dma_descriptor); 21 | LWIP_MEMPOOL_FREE(RX_POOL, my_pbuf); 22 | SYS_ARCH_UNPROTECT(old_level); 23 | } 24 | 25 | void eth_rx_irq() 26 | { 27 | dma_descriptor* dma_desc = get_RX_DMA_descriptor_from_ethernet(); 28 | my_custom_pbuf_t* my_pbuf = (my_custom_pbuf_t*)LWIP_MEMPOOL_ALLOC(RX_POOL); 29 | 30 | my_pbuf->p.custom_free_function = my_pbuf_free_custom; 31 | my_pbuf->dma_descriptor = dma_desc; 32 | 33 | invalidate_cpu_cache(dma_desc->rx_data, dma_desc->rx_length); 34 | 35 | struct pbuf* p = pbuf_alloced_custom(PBUF_RAW, 36 | dma_desc->rx_length, 37 | PBUF_REF, 38 | &my_pbuf->p, 39 | dma_desc->rx_data, 40 | dma_desc->max_buffer_size); 41 | 42 | if(netif->input(p, netif) != ERR_OK) { 43 | pbuf_free(p); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/Lwip/src/FILES: -------------------------------------------------------------------------------- 1 | api/ - The code for the high-level wrapper API. Not needed if 2 | you use the lowel-level call-back/raw API. 3 | 4 | apps/ - Higher layer applications that are specifically programmed 5 | with the lwIP low-level raw API. 6 | 7 | core/ - The core of the TPC/IP stack; protocol implementations, 8 | memory and buffer management, and the low-level raw API. 9 | 10 | include/ - lwIP include files. 11 | 12 | netif/ - Generic network interface device drivers are kept here. 13 | 14 | For more information on the various subdirectories, check the FILES 15 | file in each directory. 16 | -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/Lwip/src/apps/http/fs/404.html: -------------------------------------------------------------------------------- 1 | 2 | lwIP - A Lightweight TCP/IP Stack 3 | 4 | 5 | 6 | 19 |
7 | SICS logo 9 | 10 |

lwIP - A Lightweight TCP/IP Stack

11 |

404 - Page not found

12 |

13 | Sorry, the page you are requesting was not found on this 14 | server. 15 |

16 |
17 |   18 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/Lwip/src/apps/http/fs/img/sics.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdavi/RepRapFirmware/374100d1498cf62eab9f571e048a7358b575f994/src/Networking/LwipEthernet/Lwip/src/apps/http/fs/img/sics.gif -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/Lwip/src/apps/http/fs/index.html: -------------------------------------------------------------------------------- 1 | 2 | lwIP - A Lightweight TCP/IP Stack 3 | 4 | 5 | 6 | 44 |
7 | SICS logo 9 | 10 |

lwIP - A Lightweight TCP/IP Stack

11 |

12 | The web page you are watching was served by a simple web 13 | server running on top of the lightweight TCP/IP stack lwIP. 15 |

16 |

17 | lwIP is an open source implementation of the TCP/IP 18 | protocol suite that was originally written by Adam Dunkels 20 | of the Swedish Institute of Computer Science but now is 21 | being actively developed by a team of developers 22 | distributed world-wide. Since it's release, lwIP has 23 | spurred a lot of interest and has been ported to several 24 | platforms and operating systems. lwIP can be used either 25 | with or without an underlying OS. 26 |

27 |

28 | The focus of the lwIP TCP/IP implementation is to reduce 29 | the RAM usage while still having a full scale TCP. This 30 | makes lwIP suitable for use in embedded systems with tens 31 | of kilobytes of free RAM and room for around 40 kilobytes 32 | of code ROM. 33 |

34 |

35 | More information about lwIP can be found at the lwIP 36 | homepage at http://savannah.nongnu.org/projects/lwip/ 38 | or at the lwIP wiki at http://lwip.wikia.com/. 40 |

41 |
42 |   43 |
45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/Lwip/src/apps/http/fsdata.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2003 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef LWIP_FSDATA_H 33 | #define LWIP_FSDATA_H 34 | 35 | #include "lwip/apps/httpd_opts.h" 36 | #include "lwip/apps/fs.h" 37 | 38 | /* THIS FILE IS DEPRECATED AND WILL BE REMOVED IN THE FUTURE */ 39 | /* content was moved to fs.h to simplify #include structure */ 40 | 41 | #endif /* LWIP_FSDATA_H */ 42 | -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/Lwip/src/apps/http/makefsdata/readme.txt: -------------------------------------------------------------------------------- 1 | This directory contains a script ('makefsdata') to create C code suitable for 2 | httpd for given html pages (or other files) in a directory. 3 | 4 | There is also a plain C console application doing the same and extended a bit. 5 | 6 | Usage: htmlgen [targetdir] [-s] [-i]s 7 | targetdir: relative or absolute path to files to convert 8 | switch -s: toggle processing of subdirectories (default is on) 9 | switch -e: exclude HTTP header from file (header is created at runtime, default is on) 10 | switch -11: include HTTP 1.1 header (1.0 is default) 11 | 12 | if targetdir not specified, makefsdata will attempt to 13 | process files in subdirectory 'fs'. 14 | -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/Lwip/src/core/ipv6/inet6.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * 4 | * INET v6 addresses. 5 | */ 6 | 7 | /* 8 | * Copyright (c) 2010 Inico Technologies Ltd. 9 | * All rights reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without modification, 12 | * are permitted provided that the following conditions are met: 13 | * 14 | * 1. Redistributions of source code must retain the above copyright notice, 15 | * this list of conditions and the following disclaimer. 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, 17 | * this list of conditions and the following disclaimer in the documentation 18 | * and/or other materials provided with the distribution. 19 | * 3. The name of the author may not be used to endorse or promote products 20 | * derived from this software without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 25 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 27 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 30 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 31 | * OF SUCH DAMAGE. 32 | * 33 | * This file is part of the lwIP TCP/IP stack. 34 | * 35 | * Author: Ivan Delamer 36 | * 37 | * 38 | * Please coordinate changes and requests with Ivan Delamer 39 | * 40 | */ 41 | 42 | #include "lwip/opt.h" 43 | 44 | #if LWIP_IPV6 && LWIP_SOCKET /* don't build if not configured for use in lwipopts.h */ 45 | 46 | #include "lwip/def.h" 47 | #include "lwip/inet.h" 48 | 49 | /** This variable is initialized by the system to contain the wildcard IPv6 address. 50 | */ 51 | const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT; 52 | 53 | #endif /* LWIP_IPV6 */ 54 | -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/Lwip/src/include/arch/perf.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 4 | * \brief lwIP abstraction layer for SAM. 5 | * 6 | * Copyright (c) 2013-2015 Atmel Corporation. All rights reserved. 7 | * 8 | * \asf_license_start 9 | * 10 | * \page License 11 | * 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions are met: 14 | * 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, 19 | * this list of conditions and the following disclaimer in the documentation 20 | * and/or other materials provided with the distribution. 21 | * 22 | * 3. The name of Atmel may not be used to endorse or promote products derived 23 | * from this software without specific prior written permission. 24 | * 25 | * 4. This software may only be redistributed and used in connection with an 26 | * Atmel microcontroller product. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 29 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 30 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 31 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 32 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 34 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 35 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 36 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | * \asf_license_stop 41 | * 42 | */ 43 | 44 | #ifndef PERF_H_INCLUDED 45 | #define PERF_H_INCLUDED 46 | 47 | #define PERF_START /* null definition */ 48 | #define PERF_STOP(x) /* null definition */ 49 | 50 | #endif /* PERF_H_INCLUDED */ 51 | -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/Lwip/src/include/arch/sys_arch.h: -------------------------------------------------------------------------------- 1 | #ifndef __ARCH_SYS_ARCH_H__ 2 | #define __ARCH_SYS_ARCH_H__ 3 | 4 | #define SYS_MBOX_NULL NULL 5 | #define SYS_SEM_NULL NULL 6 | 7 | typedef void * sys_prot_t; 8 | 9 | typedef void * sys_sem_t; 10 | 11 | typedef struct 12 | { 13 | struct QueueBase *m; 14 | } sys_mbox_t; 15 | 16 | typedef void * sys_thread_t; 17 | 18 | typedef struct 19 | { 20 | struct Mutex *m; 21 | } sys_mutex_t; 22 | 23 | #endif /* __ARCH_SYS_ARCH_H__ */ 24 | -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/Lwip/src/include/compat/posix/arpa/inet.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * This file is a posix wrapper for lwip/sockets.h. 4 | */ 5 | 6 | /* 7 | * Redistribution and use in source and binary forms, with or without modification, 8 | * are permitted provided that the following conditions are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 3. The name of the author may not be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 19 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 20 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 21 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 23 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 26 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 27 | * OF SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | */ 32 | 33 | #include "lwip/sockets.h" 34 | -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/Lwip/src/include/compat/posix/net/if.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * This file is a posix wrapper for lwip/if_api.h. 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2017 Joel Cunningham, Garmin International, Inc. 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. The name of the author may not be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 30 | * OF SUCH DAMAGE. 31 | * 32 | * This file is part of the lwIP TCP/IP stack. 33 | * 34 | */ 35 | 36 | #include "lwip/if_api.h" 37 | -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/Lwip/src/include/compat/posix/netdb.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * This file is a posix wrapper for lwip/netdb.h. 4 | */ 5 | 6 | /* 7 | * Redistribution and use in source and binary forms, with or without modification, 8 | * are permitted provided that the following conditions are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 3. The name of the author may not be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 19 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 20 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 21 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 23 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 26 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 27 | * OF SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | */ 32 | 33 | #include "lwip/netdb.h" 34 | -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/Lwip/src/include/compat/posix/sys/socket.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * This file is a posix wrapper for lwip/sockets.h. 4 | */ 5 | 6 | /* 7 | * Redistribution and use in source and binary forms, with or without modification, 8 | * are permitted provided that the following conditions are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 3. The name of the author may not be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 19 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 20 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 21 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 23 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 26 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 27 | * OF SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | */ 32 | 33 | #include "lwip/sockets.h" 34 | -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/Lwip/src/include/compat/stdc/errno.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * This file is a posix/stdc wrapper for lwip/errno.h. 4 | */ 5 | 6 | /* 7 | * Redistribution and use in source and binary forms, with or without modification, 8 | * are permitted provided that the following conditions are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 3. The name of the author may not be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 19 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 20 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 21 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 23 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 26 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 27 | * OF SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | */ 32 | 33 | #include "lwip/errno.h" 34 | -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/Lwip/src/include/lwip/apps/FILES: -------------------------------------------------------------------------------- 1 | This directory contains application headers. 2 | Every application shall provide one api file APP.h and optionally one options file APP_opts.h 3 | -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/Lwip/src/include/lwip/apps/netbiosns.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * NETBIOS name service responder 4 | */ 5 | 6 | /* 7 | * Redistribution and use in source and binary forms, with or without modification, 8 | * are permitted provided that the following conditions are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 3. The name of the author may not be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 19 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 20 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 21 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 23 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 26 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 27 | * OF SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | */ 32 | #ifndef LWIP_HDR_APPS_NETBIOS_H 33 | #define LWIP_HDR_APPS_NETBIOS_H 34 | 35 | #include "lwip/apps/netbiosns_opts.h" 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | void netbiosns_init(void); 42 | #ifndef NETBIOS_LWIP_NAME 43 | void netbiosns_set_name(const char* hostname); 44 | #endif 45 | void netbiosns_stop(void); 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif /* LWIP_HDR_APPS_NETBIOS_H */ 52 | -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/Lwip/src/include/lwip/apps/smtp_opts.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_APPS_SMTP_OPTS_H 2 | #define LWIP_HDR_APPS_SMTP_OPTS_H 3 | 4 | #include "lwip/opt.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | /** 11 | * @defgroup smtp_opts Options 12 | * @ingroup smtp 13 | * 14 | * @{ 15 | */ 16 | 17 | /** Set this to 1 to enable data handler callback on BODY */ 18 | #ifndef SMTP_BODYDH 19 | #define SMTP_BODYDH 0 20 | #endif 21 | 22 | /** SMTP_DEBUG: Enable debugging for SNTP. */ 23 | #ifndef SMTP_DEBUG 24 | #define SMTP_DEBUG LWIP_DBG_OFF 25 | #endif 26 | 27 | /** Maximum length reserved for server name including terminating 0 byte */ 28 | #ifndef SMTP_MAX_SERVERNAME_LEN 29 | #define SMTP_MAX_SERVERNAME_LEN 256 30 | #endif 31 | 32 | /** Maximum length reserved for username */ 33 | #ifndef SMTP_MAX_USERNAME_LEN 34 | #define SMTP_MAX_USERNAME_LEN 32 35 | #endif 36 | 37 | /** Maximum length reserved for password */ 38 | #ifndef SMTP_MAX_PASS_LEN 39 | #define SMTP_MAX_PASS_LEN 32 40 | #endif 41 | 42 | /** Set this to 0 if you know the authentication data will not change 43 | * during the smtp session, which saves some heap space. */ 44 | #ifndef SMTP_COPY_AUTHDATA 45 | #define SMTP_COPY_AUTHDATA 1 46 | #endif 47 | 48 | /** Set this to 0 to save some code space if you know for sure that all data 49 | * passed to this module conforms to the requirements in the SMTP RFC. 50 | * WARNING: use this with care! 51 | */ 52 | #ifndef SMTP_CHECK_DATA 53 | #define SMTP_CHECK_DATA 1 54 | #endif 55 | 56 | /** Set this to 1 to enable AUTH PLAIN support */ 57 | #ifndef SMTP_SUPPORT_AUTH_PLAIN 58 | #define SMTP_SUPPORT_AUTH_PLAIN 1 59 | #endif 60 | 61 | /** Set this to 1 to enable AUTH LOGIN support */ 62 | #ifndef SMTP_SUPPORT_AUTH_LOGIN 63 | #define SMTP_SUPPORT_AUTH_LOGIN 1 64 | #endif 65 | 66 | /* Memory allocation/deallocation can be overridden... */ 67 | #ifndef SMTP_STATE_MALLOC 68 | #define SMTP_STATE_MALLOC(size) mem_malloc(size) 69 | #define SMTP_STATE_FREE(ptr) mem_free(ptr) 70 | #endif 71 | 72 | /** 73 | * @} 74 | */ 75 | 76 | #ifdef __cplusplus 77 | } 78 | #endif 79 | 80 | #endif /* SMTP_OPTS_H */ 81 | 82 | -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/Lwip/src/include/lwip/apps/snmp_snmpv2_framework.h: -------------------------------------------------------------------------------- 1 | /* 2 | Generated by LwipMibCompiler 3 | */ 4 | 5 | #ifndef LWIP_HDR_APPS_SNMP_FRAMEWORK_MIB_H 6 | #define LWIP_HDR_APPS_SNMP_FRAMEWORK_MIB_H 7 | 8 | #include "lwip/apps/snmp_opts.h" 9 | #if LWIP_SNMP 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif /* __cplusplus */ 14 | 15 | #include "lwip/apps/snmp_core.h" 16 | 17 | extern const struct snmp_obj_id usmNoAuthProtocol; 18 | extern const struct snmp_obj_id usmHMACMD5AuthProtocol; 19 | extern const struct snmp_obj_id usmHMACSHAAuthProtocol; 20 | 21 | extern const struct snmp_obj_id usmNoPrivProtocol; 22 | extern const struct snmp_obj_id usmDESPrivProtocol; 23 | extern const struct snmp_obj_id usmAESPrivProtocol; 24 | 25 | extern const struct snmp_mib snmpframeworkmib; 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif /* __cplusplus */ 30 | 31 | #endif /* LWIP_SNMP */ 32 | #endif /* LWIP_HDR_APPS_SNMP_FRAMEWORK_MIB_H */ 33 | -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/Lwip/src/include/lwip/apps/snmp_snmpv2_usm.h: -------------------------------------------------------------------------------- 1 | /* 2 | Generated by LwipMibCompiler 3 | */ 4 | 5 | #ifndef LWIP_HDR_APPS_SNMP_USER_BASED_SM_MIB_H 6 | #define LWIP_HDR_APPS_SNMP_USER_BASED_SM_MIB_H 7 | 8 | #include "lwip/apps/snmp_opts.h" 9 | #if LWIP_SNMP 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif /* __cplusplus */ 14 | 15 | #include "lwip/apps/snmp_core.h" 16 | 17 | extern const struct snmp_mib snmpusmmib; 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif /* __cplusplus */ 22 | 23 | #endif /* LWIP_SNMP */ 24 | #endif /* LWIP_HDR_APPS_SNMP_USER_BASED_SM_MIB_H */ 25 | -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/Lwip/src/include/netif/etharp.h: -------------------------------------------------------------------------------- 1 | /* ARP has been moved to core/ipv4, provide this #include for compatibility only */ 2 | #include "lwip/etharp.h" 3 | #include "netif/ethernet.h" 4 | -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/Lwip/src/include/netif/ppp/chap-md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * chap-md5.h - New CHAP/MD5 implementation. 3 | * 4 | * Copyright (c) 2003 Paul Mackerras. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. The name(s) of the authors of this software must not be used to 14 | * endorse or promote products derived from this software without 15 | * prior written permission. 16 | * 17 | * 3. Redistributions of any form whatsoever must retain the following 18 | * acknowledgment: 19 | * "This product includes software developed by Paul Mackerras 20 | * ". 21 | * 22 | * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO 23 | * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 24 | * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 25 | * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 26 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 27 | * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 28 | * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 29 | */ 30 | 31 | #include "netif/ppp/ppp_opts.h" 32 | #if PPP_SUPPORT && CHAP_SUPPORT /* don't build if not configured for use in lwipopts.h */ 33 | 34 | extern const struct chap_digest_type md5_digest; 35 | 36 | #endif /* PPP_SUPPORT && CHAP_SUPPORT */ 37 | -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/Lwip/src/include/netif/ppp/chap_ms.h: -------------------------------------------------------------------------------- 1 | /* 2 | * chap_ms.h - Challenge Handshake Authentication Protocol definitions. 3 | * 4 | * Copyright (c) 1995 Eric Rosenquist. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * 3. The name(s) of the authors of this software must not be used to 19 | * endorse or promote products derived from this software without 20 | * prior written permission. 21 | * 22 | * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO 23 | * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 24 | * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 25 | * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 26 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 27 | * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 28 | * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 29 | * 30 | * $Id: chap_ms.h,v 1.13 2004/11/15 22:13:26 paulus Exp $ 31 | */ 32 | 33 | #include "netif/ppp/ppp_opts.h" 34 | #if PPP_SUPPORT && MSCHAP_SUPPORT /* don't build if not configured for use in lwipopts.h */ 35 | 36 | #ifndef CHAPMS_INCLUDE 37 | #define CHAPMS_INCLUDE 38 | 39 | extern const struct chap_digest_type chapms_digest; 40 | extern const struct chap_digest_type chapms2_digest; 41 | 42 | #endif /* CHAPMS_INCLUDE */ 43 | 44 | #endif /* PPP_SUPPORT && MSCHAP_SUPPORT */ 45 | -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/Lwip/src/include/netif/ppp/ecp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ecp.h - Definitions for PPP Encryption Control Protocol. 3 | * 4 | * Copyright (c) 2002 Google, Inc. 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in 16 | * the documentation and/or other materials provided with the 17 | * distribution. 18 | * 19 | * 3. The name(s) of the authors of this software must not be used to 20 | * endorse or promote products derived from this software without 21 | * prior written permission. 22 | * 23 | * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO 24 | * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 25 | * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 26 | * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 27 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 28 | * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 29 | * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 30 | * 31 | * $Id: ecp.h,v 1.2 2003/01/10 07:12:36 fcusack Exp $ 32 | */ 33 | 34 | #include "netif/ppp/ppp_opts.h" 35 | #if PPP_SUPPORT && ECP_SUPPORT /* don't build if not configured for use in lwipopts.h */ 36 | 37 | #ifndef ECP_H 38 | #define ECP_H 39 | 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | typedef struct ecp_options { 45 | bool required; /* Is ECP required? */ 46 | unsigned enctype; /* Encryption type */ 47 | } ecp_options; 48 | 49 | extern fsm ecp_fsm[]; 50 | extern ecp_options ecp_wantoptions[]; 51 | extern ecp_options ecp_gotoptions[]; 52 | extern ecp_options ecp_allowoptions[]; 53 | extern ecp_options ecp_hisoptions[]; 54 | 55 | extern const struct protent ecp_protent; 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | 61 | #endif /* ECP_H */ 62 | #endif /* PPP_SUPPORT && ECP_SUPPORT */ 63 | -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/Lwip/src/netif/FILES: -------------------------------------------------------------------------------- 1 | This directory contains generic network interface device drivers that 2 | do not contain any hardware or architecture specific code. The files 3 | are: 4 | 5 | ethernet.c 6 | Shared code for Ethernet based interfaces. 7 | 8 | lowpan6.c 9 | A 6LoWPAN implementation as a netif. 10 | 11 | lowpan6_ble.c 12 | A 6LoWPAN over Bluetooth Low Energy (BLE) implementation as netif, 13 | according to RFC-7668. 14 | 15 | slipif.c 16 | A generic implementation of the SLIP (Serial Line IP) 17 | protocol. It requires a sio (serial I/O) module to work. 18 | 19 | ppp/ Point-to-Point Protocol stack 20 | The lwIP PPP support is based from pppd (http://ppp.samba.org) with 21 | huge changes to match code size and memory requirements for embedded 22 | devices. Please read /doc/ppp.txt and ppp/PPPD_FOLLOWUP for a detailed 23 | explanation. 24 | -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/Lwip/src/netif/ppp/polarssl/README: -------------------------------------------------------------------------------- 1 | About PolarSSL files into lwIP PPP support 2 | ------------------------------------------ 3 | 4 | This folder contains some files fetched from the latest BSD release of 5 | the PolarSSL project (PolarSSL 0.10.1-bsd) for ciphers and encryption 6 | methods we need for lwIP PPP support. 7 | 8 | The PolarSSL files were cleaned to contain only the necessary struct 9 | fields and functions needed for lwIP. 10 | 11 | The PolarSSL API was not changed at all, so if you are already using 12 | PolarSSL you can choose to skip the compilation of the included PolarSSL 13 | library into lwIP. 14 | 15 | If you are not using the embedded copy you must include external 16 | libraries into your arch/cc.h port file. 17 | 18 | Beware of the stack requirements which can be a lot larger if you are not 19 | using our cleaned PolarSSL library. 20 | 21 | 22 | PolarSSL project website: http://polarssl.org/ 23 | -------------------------------------------------------------------------------- /src/Networking/LwipEthernet/LwipSocket.h: -------------------------------------------------------------------------------- 1 | /* 2 | * LwipSocket.h 3 | * 4 | * Created on: 20 Nov 2017 5 | * Authors: David and Christian 6 | */ 7 | 8 | #ifndef SRC_SAME70_LWIPSOCKET_H_ 9 | #define SRC_SAME70_LWIPSOCKET_H_ 10 | 11 | #include "LwipEthernetInterface.h" 12 | #include "Networking/NetworkDefs.h" 13 | #include "Networking/Socket.h" 14 | 15 | 16 | typedef int8_t err_t; 17 | struct tcp_pcb; 18 | struct pbuf; 19 | 20 | // Socket structure for LwIP that we use to track TCP connections 21 | class LwipSocket : public Socket 22 | { 23 | public: 24 | LwipSocket(NetworkInterface *iface) noexcept; 25 | int GetState() const noexcept { return (int)state; } // for debugging 26 | 27 | // LwIP interfaces 28 | bool AcceptConnection(tcp_pcb *pcb) noexcept; 29 | void DataReceived(pbuf *data) noexcept; 30 | void DataSent(size_t numBytes) noexcept; 31 | void ConnectionClosedGracefully() noexcept; 32 | void ConnectionError(err_t err) noexcept; 33 | 34 | // Inherited members of the Socket class 35 | void Init(SocketNumber s, Port serverPort, NetworkProtocol p) noexcept; 36 | void TerminateAndDisable() noexcept override; 37 | void Poll() noexcept override; 38 | void Close() noexcept override; 39 | bool IsClosing() const noexcept { return (state == SocketState::closing); } 40 | void Terminate() noexcept override; 41 | bool ReadChar(char& c) noexcept override; 42 | bool ReadBuffer(const uint8_t *&buffer, size_t &len) noexcept override; 43 | void Taken(size_t len) noexcept override; 44 | bool CanRead() const noexcept override; 45 | bool CanSend() const noexcept override; 46 | size_t Send(const uint8_t *data, size_t length) noexcept override; 47 | void Send() noexcept override { } 48 | 49 | private: 50 | enum class SocketState : uint8_t 51 | { 52 | disabled, 53 | inactive, 54 | listening, 55 | connected, 56 | clientDisconnecting, 57 | closing, 58 | aborted 59 | }; 60 | 61 | void ReInit() noexcept; 62 | void DiscardReceivedData() noexcept; 63 | 64 | uint32_t whenConnected; 65 | uint32_t whenWritten; 66 | uint32_t whenClosed; 67 | bool responderFound; 68 | 69 | tcp_pcb *connectionPcb; 70 | pbuf *receivedData; 71 | size_t readIndex; 72 | 73 | SocketState state; 74 | size_t unAcked; 75 | }; 76 | 77 | #endif /* SRC_SAME70_LWIPSOCKET_H_ */ 78 | -------------------------------------------------------------------------------- /src/Networking/NetworkInterface.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * NetworkInterface.cpp 3 | * 4 | * Created on: 10 Mar 2020 5 | * Author: David 6 | */ 7 | 8 | #include "NetworkInterface.h" 9 | #include 10 | 11 | void NetworkInterface::SetState(NetworkState::RawType newState) noexcept 12 | { 13 | state = newState; 14 | reprap.NetworkUpdated(); 15 | } 16 | 17 | // End 18 | -------------------------------------------------------------------------------- /src/Networking/TelnetResponder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TelnetResponder.h 3 | * 4 | * Created on: 14 Apr 2017 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_NETWORKING_TELNETRESPONDER_H_ 9 | #define SRC_NETWORKING_TELNETRESPONDER_H_ 10 | 11 | #include "NetworkResponder.h" 12 | 13 | class TelnetResponder : public NetworkResponder 14 | { 15 | public: 16 | TelnetResponder(NetworkResponder *n) noexcept; 17 | bool Spin() noexcept override; // do some work, returning true if we did anything significant 18 | bool Accept(Socket *s, NetworkProtocol protocol) noexcept override; // ask the responder to accept this connection, returns true if it did 19 | void Terminate(NetworkProtocol protocol, NetworkInterface *interface) noexcept override; // terminate the responder if it is serving the specified protocol on the specified interface 20 | 21 | static void InitStatic() noexcept; 22 | static void Disable() noexcept; 23 | static void HandleGCodeReply(const char *reply) noexcept; 24 | static void HandleGCodeReply(OutputBuffer *reply) noexcept; 25 | void Diagnostics(MessageType mtype) const noexcept override; 26 | 27 | private: 28 | void CharFromClient(char c) noexcept; 29 | void ProcessLine() noexcept; 30 | void ConnectionLost() noexcept override; 31 | 32 | bool SendGCodeReply() noexcept; 33 | 34 | bool haveCompleteLine; 35 | char clientMessage[GCODE_LENGTH]; 36 | size_t clientPointer; 37 | uint32_t connectTime; 38 | 39 | static unsigned int numSessions; 40 | static unsigned int clientsServed; 41 | static OutputBuffer *gcodeReply; 42 | static Mutex gcodeReplyMutex; 43 | 44 | static const uint32_t TelnetSetupDuration = 4000; // ignore the first Telnet request within this duration (in ms) 45 | }; 46 | 47 | #endif /* SRC_NETWORKING_TELNETRESPONDER_H_ */ 48 | -------------------------------------------------------------------------------- /src/Networking/UploadingNetworkResponder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * UploadingNetworkResponder.h 3 | * 4 | * Created on: 3 Feb 2019 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_NETWORKING_UPLOADINGNETWORKRESPONDER_H_ 9 | #define SRC_NETWORKING_UPLOADINGNETWORKRESPONDER_H_ 10 | 11 | #include "NetworkResponder.h" 12 | 13 | class UploadingNetworkResponder : public NetworkResponder 14 | { 15 | protected: 16 | UploadingNetworkResponder(NetworkResponder *n) noexcept; 17 | 18 | void ConnectionLost() noexcept override; 19 | virtual void CancelUpload() noexcept; 20 | 21 | #if HAS_MASS_STORAGE 22 | FileStore * StartUpload(const char* folder, const char *fileName, const OpenMode mode, const uint32_t preAllocSize = 0) noexcept; 23 | void FinishUpload(uint32_t fileLength, time_t fileLastModified, bool gotCrc, uint32_t expectedCrc) noexcept; 24 | 25 | // File uploads 26 | FileData fileBeingUploaded; 27 | uint32_t uploadedBytes; // how many bytes have already been written 28 | bool uploadError; 29 | #endif 30 | 31 | String filenameBeingProcessed; // usually the name of the file being uploaded, but also used by HttpResponder and FtpResponder 32 | }; 33 | 34 | #endif /* SRC_NETWORKING_UPLOADINGNETWORKRESPONDER_H_ */ 35 | -------------------------------------------------------------------------------- /src/Networking/W5500Ethernet/MdnsResponder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * mDNSResponder.h 3 | * 4 | * Created on: 18 Sep 2019 5 | * Author: Christian 6 | */ 7 | 8 | #ifndef SRC_NETWORKING_W5500ETHERNET_MDNSRESPONDER_H_ 9 | #define SRC_NETWORKING_W5500ETHERNET_MDNSRESPONDER_H_ 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | #include "Configuration.h" 18 | #include "NetworkDefs.h" 19 | 20 | class W5500Socket; 21 | 22 | class MdnsResponder { 23 | public: 24 | MdnsResponder(W5500Socket *sock) noexcept; 25 | 26 | void UpdateServiceRecords() noexcept; 27 | void Spin() noexcept; 28 | void Announce() noexcept; 29 | 30 | private: 31 | W5500Socket *socket; 32 | uint32_t lastAnnouncement; 33 | 34 | void ProcessPacket(const uint8_t *data, size_t length) const noexcept; 35 | bool CheckHostname(const uint8_t *ptr, size_t maxLength, size_t *bytesProcessed) const noexcept; 36 | void SendARecord(uint16_t transaction) const noexcept; 37 | }; 38 | 39 | #endif /* SRC_NETWORKING_W5500ETHERNET_MDNSRESPONDER_H_ */ 40 | -------------------------------------------------------------------------------- /src/Networking/W5500Ethernet/W5500Socket.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Socket.h 3 | * 4 | * Created on: 25 Dec 2016 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_NETWORKING_W5500SOCKET_H_ 9 | #define SRC_NETWORKING_W5500SOCKET_H_ 10 | 11 | #include "RepRapFirmware.h" 12 | #include "NetworkDefs.h" 13 | #include "Socket.h" 14 | 15 | // Socket structure that we use to track TCP connections 16 | class W5500Socket : public Socket 17 | { 18 | public: 19 | W5500Socket(NetworkInterface *iface) noexcept; 20 | void Init(SocketNumber s, Port serverPort, NetworkProtocol p) noexcept; 21 | 22 | void Poll() noexcept override; 23 | void Close() noexcept override; 24 | void Terminate() noexcept override; 25 | void TerminateAndDisable() noexcept override; 26 | bool ReadChar(char& c) noexcept override; 27 | bool ReadBuffer(const uint8_t *&buffer, size_t &len) noexcept override; 28 | void Taken(size_t len) noexcept override; 29 | bool CanRead() const noexcept override; 30 | bool CanSend() const noexcept override; 31 | size_t Send(const uint8_t *data, size_t length) noexcept override; 32 | void Send() noexcept override; 33 | 34 | private: 35 | void ReInit() noexcept; 36 | void ReceiveData() noexcept; 37 | void DiscardReceivedData() noexcept; 38 | 39 | NetworkBuffer *receivedData; // List of buffers holding received data 40 | uint32_t whenConnected; 41 | bool persistConnection; // Do we expect this connection to stay alive? 42 | bool isTerminated; // Will be true if the connection has gone down unexpectedly (TCP RST) 43 | SocketNumber socketNum; // The W5500 socket number we are using 44 | bool sendOutstanding; // True if we have written data to the socket but not flushed it 45 | bool isSending; // True if we have written data to the W5500 to send and have not yet seen success or timeout 46 | uint16_t wizTxBufferPtr; // Current offset into the Wizchip send buffer, if sendOutstanding is true 47 | uint16_t wizTxBufferLeft; // Transmit buffer space left, if sendOutstanding is true 48 | }; 49 | 50 | #endif /* SRC_NETWORKING_W5500SOCKET_H_ */ 51 | -------------------------------------------------------------------------------- /src/Networking/W5500Ethernet/Wiznet/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /src/Networking/W5500Ethernet/Wiznet/.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # ========================= 18 | # Operating System Files 19 | # ========================= 20 | 21 | # OSX 22 | # ========================= 23 | 24 | .DS_Store 25 | .AppleDouble 26 | .LSOverride 27 | 28 | # Icon must end with two \r 29 | Icon 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear on external disk 35 | .Spotlight-V100 36 | .Trashes 37 | 38 | # Directories potentially created on remote AFP share 39 | .AppleDB 40 | .AppleDesktop 41 | Network Trash Folder 42 | Temporary Items 43 | .apdisk 44 | -------------------------------------------------------------------------------- /src/Networking/W5500Ethernet/Wiznet/Ethernet/Socket_APIs_V3.0.3.chm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdavi/RepRapFirmware/374100d1498cf62eab9f571e048a7358b575f994/src/Networking/W5500Ethernet/Wiznet/Ethernet/Socket_APIs_V3.0.3.chm -------------------------------------------------------------------------------- /src/Networking/W5500Ethernet/Wiznet/Ethernet/WizSpi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Spi.h 3 | * 4 | * Created on: 16 Dec 2016 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_DUETNG_DUETETHERNET_ETHERNET3_UTILITY_WIZSPI_H_ 9 | #define SRC_DUETNG_DUETETHERNET_ETHERNET3_UTILITY_WIZSPI_H_ 10 | 11 | #include "RepRapFirmware.h" 12 | #include "spi/spi.h" 13 | 14 | namespace WizSpi 15 | { 16 | void Init() noexcept; 17 | void Stop() noexcept; 18 | void AssertSS() noexcept; 19 | void ReleaseSS() noexcept; 20 | void SendAddress(uint32_t addr) noexcept; 21 | uint8_t ReadByte() noexcept; 22 | void WriteByte(uint8_t b) noexcept; 23 | spi_status_t ReadBurst(uint8_t* rx_data, size_t len) noexcept; 24 | spi_status_t SendBurst(const uint8_t* tx_data, size_t len) noexcept; 25 | } 26 | 27 | #endif /* SRC_DUETNG_DUETETHERNET_ETHERNET3_UTILITY_WIZSPI_H_ */ 28 | -------------------------------------------------------------------------------- /src/Pccb/Network.cpp: -------------------------------------------------------------------------------- 1 | #include "Network.h" 2 | #include "OutputMemory.h" 3 | 4 | const char * const notSupportedText = "Networking is not supported on this hardware"; 5 | 6 | // MacAddress members 7 | uint32_t MacAddress::LowWord() const noexcept 8 | { 9 | return (((((bytes[3] << 8) | bytes[2]) << 8) | bytes[1]) << 8) | bytes[0]; 10 | } 11 | 12 | uint16_t MacAddress::HighWord() const noexcept 13 | { 14 | return (bytes[5] << 8) | bytes[4]; 15 | } 16 | 17 | void MacAddress::SetFromBytes(const uint8_t mb[6]) noexcept 18 | { 19 | memcpy(bytes, mb, sizeof(bytes)); 20 | } 21 | 22 | // Network members 23 | GCodeResult Network::SetMacAddress(unsigned int interface, const MacAddress& mac, const StringRef& reply) noexcept 24 | { 25 | reply.copy(notSupportedText); 26 | return GCodeResult::error; 27 | } 28 | 29 | GCodeResult Network::EnableProtocol(unsigned int interface, int protocol, int port, bool secure, const StringRef& reply) noexcept 30 | { 31 | reply.copy(notSupportedText); 32 | return GCodeResult::error; 33 | } 34 | 35 | GCodeResult Network::DisableProtocol(unsigned int interface, int protocol, const StringRef& reply) noexcept 36 | { 37 | reply.copy(notSupportedText); 38 | return GCodeResult::error; 39 | } 40 | 41 | GCodeResult Network::ReportProtocols(unsigned int interface, const StringRef& reply) const noexcept 42 | { 43 | reply.copy(notSupportedText); 44 | return GCodeResult::error; 45 | } 46 | 47 | GCodeResult Network::EnableInterface(unsigned int interface, int mode, const StringRef& ssid, const StringRef& reply) noexcept 48 | { 49 | reply.copy(notSupportedText); 50 | return GCodeResult::error; 51 | } 52 | 53 | GCodeResult Network::GetNetworkState(unsigned int interface, const StringRef& reply) noexcept 54 | { 55 | reply.copy(notSupportedText); 56 | return GCodeResult::error; 57 | } 58 | 59 | void Network::HandleHttpGCodeReply(OutputBuffer *buf) noexcept 60 | { 61 | OutputBuffer::ReleaseAll(buf); 62 | } 63 | 64 | void Network::HandleTelnetGCodeReply(OutputBuffer *buf) noexcept 65 | { 66 | OutputBuffer::ReleaseAll(buf); 67 | } 68 | 69 | // End 70 | -------------------------------------------------------------------------------- /src/Pccb/Network.h: -------------------------------------------------------------------------------- 1 | #ifndef NETWORK_H 2 | #define NETWORK_H 3 | 4 | #include "RepRapFirmware.h" 5 | #include "MessageType.h" 6 | #include "GCodes/GCodeResult.h" 7 | #include "General/IPAddress.h" 8 | #include 9 | 10 | // The main network class that drives the network. 11 | class Network 12 | { 13 | public: 14 | Network(Platform& p) noexcept { macAddress.SetDefault(); } 15 | void Init() const noexcept { } 16 | void Activate() const noexcept { } 17 | void Exit() const noexcept { } 18 | void Diagnostics(MessageType mtype) const noexcept { } 19 | 20 | GCodeResult EnableInterface(unsigned int interface, int mode, const StringRef& ssid, const StringRef& reply) noexcept; 21 | GCodeResult EnableProtocol(unsigned int interface, int protocol, int port, bool secure, const StringRef& reply) noexcept; 22 | GCodeResult DisableProtocol(unsigned int interface, int protocol, const StringRef& reply) noexcept; 23 | GCodeResult ReportProtocols(unsigned int interface, const StringRef& reply) const noexcept; 24 | 25 | GCodeResult GetNetworkState(unsigned int interface, const StringRef& reply) noexcept; 26 | 27 | void SetEthernetIPAddress(IPAddress p_ipAddress, IPAddress p_netmask, IPAddress p_gateway) noexcept { } 28 | GCodeResult SetMacAddress(unsigned int interface, const MacAddress& mac, const StringRef& reply) noexcept; 29 | const MacAddress& GetMacAddress(unsigned int interface) const noexcept { return macAddress; } 30 | 31 | void SetHostname(const char *name) const noexcept { } 32 | bool IsWiFiInterface(unsigned int interface) const noexcept { return false; } 33 | 34 | void HandleHttpGCodeReply(const char *msg) noexcept { } 35 | void HandleTelnetGCodeReply(const char *msg) noexcept { } 36 | void HandleHttpGCodeReply(OutputBuffer *buf) noexcept; 37 | void HandleTelnetGCodeReply(OutputBuffer *buf) noexcept; 38 | uint32_t GetHttpReplySeq() noexcept { return 0; } 39 | 40 | private: 41 | MacAddress macAddress; 42 | }; 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/Pccb/Pins_Pccb.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Pins_DuetNG.cpp 3 | * 4 | * Created on: 31 Mar 2019 5 | * Author: David 6 | */ 7 | 8 | #include "RepRapFirmware.h" 9 | 10 | // Hardware-dependent pins functions 11 | 12 | // Function to look up a pin name pass back the corresponding index into the pin table 13 | // On this platform, the mapping from pin names to pins is fixed, so this is a simple lookup 14 | bool LookupPinName(const char*pn, LogicalPin& lpin, bool& hardwareInverted) noexcept 15 | { 16 | if (StringEqualsIgnoreCase(pn, NoPinName)) 17 | { 18 | lpin = NoLogicalPin; 19 | hardwareInverted = false; 20 | return true; 21 | } 22 | 23 | for (size_t lp = 0; lp < ARRAY_SIZE(PinTable); ++lp) 24 | { 25 | const char *q = PinTable[lp].names; 26 | while (*q != 0) 27 | { 28 | // Try the next alias in the list of names for this pin 29 | const char *p = pn; 30 | bool hwInverted = (*q == '!'); 31 | if (hwInverted) 32 | { 33 | ++q; 34 | } 35 | while (*q != ',' && *q != 0 && *p == *q) 36 | { 37 | ++p; 38 | ++q; 39 | } 40 | if (*p == 0 && (*q == 0 || *q == ',')) 41 | { 42 | // Found a match 43 | lpin = (LogicalPin)lp; 44 | hardwareInverted = hwInverted; 45 | return true; 46 | } 47 | 48 | // Skip to the start of the next alias 49 | while (*q != 0 && *q != ',') 50 | { 51 | ++q; 52 | } 53 | if (*q == ',') 54 | { 55 | ++q; 56 | } 57 | } 58 | } 59 | return false; 60 | } 61 | 62 | // End 63 | -------------------------------------------------------------------------------- /src/PortControl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PortControl.h 3 | * 4 | * Created on: 15 Jun 2017 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_PORTCONTROL_H_ 9 | #define SRC_PORTCONTROL_H_ 10 | 11 | #include "RepRapFirmware.h" 12 | #include "Hardware/IoPorts.h" 13 | 14 | class GCodeBuffer; 15 | 16 | #if SUPPORT_IOBITS 17 | 18 | class PortControl 19 | { 20 | public: 21 | PortControl() noexcept; 22 | void Init() noexcept; 23 | void Exit() noexcept; 24 | uint32_t UpdatePorts() noexcept; 25 | bool Configure(GCodeBuffer& gb, const StringRef& reply); 26 | 27 | private: 28 | void UpdatePorts(IoBits_t newPortState) noexcept; 29 | 30 | static const size_t MaxPorts = 16; // the port bitmap is currently a 16-bit word 31 | 32 | IoPort portMap[MaxPorts]; 33 | size_t numConfiguredPorts; 34 | unsigned int advanceMillis; 35 | uint32_t advanceClocks; 36 | IoBits_t currentPortState; 37 | }; 38 | 39 | #endif 40 | 41 | #endif /* SRC_PORTCONTROL_H_ */ 42 | -------------------------------------------------------------------------------- /src/RADDS/Network.cpp: -------------------------------------------------------------------------------- 1 | #include "Network.h" 2 | #include "OutputMemory.h" 3 | 4 | const char * const notSupportedText = "Networking is not supported on this hardware"; 5 | 6 | GCodeResult Network::EnableProtocol(unsigned int interface, int protocol, int port, bool secure, const StringRef& reply) 7 | { 8 | reply.copy(notSupportedText); 9 | return GCodeResult::error; 10 | } 11 | 12 | GCodeResult Network::DisableProtocol(unsigned int interface, int protocol, const StringRef& reply) 13 | { 14 | reply.copy(notSupportedText); 15 | return GCodeResult::error; 16 | } 17 | 18 | GCodeResult Network::ReportProtocols(unsigned int interface, const StringRef& reply) const 19 | { 20 | reply.copy(notSupportedText); 21 | return GCodeResult::error; 22 | } 23 | 24 | GCodeResult Network::EnableInterface(unsigned int interface, int mode, const StringRef& ssid, const StringRef& reply) 25 | { 26 | reply.copy(notSupportedText); 27 | return GCodeResult::error; 28 | } 29 | 30 | GCodeResult Network::GetNetworkState(unsigned int interface, const StringRef& reply) 31 | { 32 | reply.copy(notSupportedText); 33 | return GCodeResult::error; 34 | } 35 | 36 | void Network::HandleHttpGCodeReply(OutputBuffer *buf) 37 | { 38 | OutputBuffer::ReleaseAll(buf); 39 | } 40 | 41 | void Network::HandleTelnetGCodeReply(OutputBuffer *buf) 42 | { 43 | OutputBuffer::ReleaseAll(buf); 44 | } 45 | 46 | // End 47 | -------------------------------------------------------------------------------- /src/RADDS/Network.h: -------------------------------------------------------------------------------- 1 | #ifndef NETWORK_H 2 | #define NETWORK_H 3 | 4 | #include "RepRapFirmware.h" 5 | #include "MessageType.h" 6 | #include "GCodes/GCodeResult.h" 7 | #include "General/IPAddress.h" 8 | 9 | const IPAddress DefaultIpAddress; 10 | const IPAddress DefaultNetMask; 11 | const IPAddress DefaultGateway; 12 | const uint8_t macAddress[6] = { 0, 0, 0, 0, 0, 0 }; 13 | 14 | const uint8_t DefaultMacAddress[6] = { 0, 0, 0, 0, 0, 0 }; 15 | 16 | const size_t SsidBufferLength = 32; // maximum characters in an SSID 17 | 18 | // The main network class that drives the network. 19 | class Network 20 | { 21 | public: 22 | Network(Platform& p) { } 23 | void Init() const { } 24 | void Activate() const { } 25 | void Exit() const { } 26 | void Spin(bool full) const { } 27 | void Interrupt() const { } 28 | void Diagnostics(MessageType mtype) const { } 29 | 30 | GCodeResult EnableInterface(unsigned int interface, int mode, const StringRef& ssid, const StringRef& reply); 31 | GCodeResult EnableProtocol(unsigned int interface, int protocol, int port, bool secure, const StringRef& reply); 32 | GCodeResult DisableProtocol(unsigned int interface, int protocol, const StringRef& reply); 33 | GCodeResult ReportProtocols(unsigned int interface, const StringRef& reply) const; 34 | 35 | GCodeResult GetNetworkState(unsigned int interface, const StringRef& reply); 36 | 37 | void SetEthernetIPAddress(IPAddress p_ipAddress, IPAddress p_netmask, IPAddress p_gateway) { } 38 | void SetMacAddress(unsigned int interface, const uint8_t mac[]) { } 39 | const uint8_t *GetMacAddress(unsigned int interface) const { return macAddress; } 40 | 41 | void SetHostname(const char *name) const { } 42 | bool IsWiFiInterface(unsigned int interface) const { return false; } 43 | 44 | void HandleHttpGCodeReply(const char *msg) { } 45 | void HandleTelnetGCodeReply(const char *msg) { } 46 | void HandleHttpGCodeReply(OutputBuffer *buf); 47 | void HandleTelnetGCodeReply(OutputBuffer *buf); 48 | uint32_t GetHttpReplySeq() { return 0; } 49 | }; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /src/RADDS/Pins_RADDS.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Pins_DuetNG.cpp 3 | * 4 | * Created on: 31 Mar 2019 5 | * Author: David 6 | */ 7 | 8 | #include "RepRapFirmware.h" 9 | 10 | // Hardware-dependent pins functions 11 | 12 | // Function to look up a pin name pass back the corresponding index into the pin table 13 | // On this platform, the mapping from pin names to pins is fixed, so this is a simple lookup 14 | bool LookupPinName(const char*pn, LogicalPin& lpin, bool& hardwareInverted) 15 | { 16 | if (StringEqualsIgnoreCase(pn, NoPinName)) 17 | { 18 | lpin = NoLogicalPin; 19 | hardwareInverted = false; 20 | return true; 21 | } 22 | 23 | for (size_t lp = 0; lp < ARRAY_SIZE(PinTable); ++lp) 24 | { 25 | const char *q = PinTable[lp].names; 26 | while (*q != 0) 27 | { 28 | // Try the next alias in the list of names for this pin 29 | const char *p = pn; 30 | bool hwInverted = (*q == '!'); 31 | if (hwInverted) 32 | { 33 | ++q; 34 | } 35 | while (*q != ',' && *q != 0 && *p == *q) 36 | { 37 | ++p; 38 | ++q; 39 | } 40 | if (*p == 0 && (*q == 0 || *q == ',')) 41 | { 42 | // Found a match 43 | lpin = (LogicalPin)lp; 44 | hardwareInverted = hwInverted; 45 | return true; 46 | } 47 | 48 | // Skip to the start of the next alias 49 | while (*q != 0 && *q != ',') 50 | { 51 | ++q; 52 | } 53 | if (*q == ',') 54 | { 55 | ++q; 56 | } 57 | } 58 | } 59 | return false; 60 | } 61 | 62 | // End 63 | -------------------------------------------------------------------------------- /src/RepRapFirmware.pdp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdavi/RepRapFirmware/374100d1498cf62eab9f571e048a7358b575f994/src/RepRapFirmware.pdp -------------------------------------------------------------------------------- /src/Roland.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************** 2 | 3 | RepRapFirmware - Roland 4 | 5 | This class can interface with a Roland mill (e.g. Roland MDX-20/15) and allows the underlying hardware 6 | to act as a G-Code proxy, which translates G-Codes to internal Roland commands. 7 | 8 | ----------------------------------------------------------------------------------------------------- 9 | 10 | Version 0.1 11 | 12 | Created on: Oct 14, 2015 13 | 14 | Adrian Bowyer 15 | 16 | Licence: GPL 17 | 18 | ****************************************************************************************************/ 19 | 20 | #ifndef ROLAND_H 21 | #define ROLAND_H 22 | 23 | #if SUPPORT_ROLAND 24 | 25 | // This class allows the RepRap firmware to transmit commands to a Roland mill 26 | // See: http://www.rolanddg.com/product/3d/3d/mdx-20_15/mdx-20_15.html 27 | // http://altlab.org/d/content/m/pangelo/ideas/rml_command_guide_en_v100.pdf 28 | 29 | #include "RepRapFirmware.h" 30 | #include "Core.h" 31 | #include "Platform.h" 32 | 33 | const float ROLAND_FACTOR = (1.016088061*100.0/2.54); // Roland units are 0.001" 34 | const size_t ROLAND_BUFFER_SIZE = 50; 35 | 36 | class Roland 37 | { 38 | public: 39 | Roland(Platform& p); 40 | void Init(); 41 | void Spin(); 42 | bool ProcessHome(); 43 | bool ProcessDwell(long milliseconds); 44 | bool ProcessG92(float v, size_t axis); 45 | bool ProcessSpindle(float rpm); 46 | bool RawWrite(const char* s); 47 | void GetCurrentRolandPosition(float moveBuffer[]); 48 | bool Active(); 49 | void Activate(); 50 | bool Deactivate(); 51 | 52 | private: 53 | void ProcessMove(); 54 | void Zero(bool feed); 55 | bool Busy(); 56 | 57 | Platform& platform; 58 | float longWait; 59 | 60 | float move[DRIVES+1]; 61 | float coordinates[AXES+1]; 62 | float oldCoordinates[AXES+1]; 63 | float offset[AXES+1]; 64 | char buffer[ROLAND_BUFFER_SIZE]; 65 | int bufferPointer; 66 | StringRef *sBuffer; 67 | bool active; 68 | }; 69 | 70 | #endif 71 | 72 | #endif 73 | 74 | // vim: ts=4:sw=4 75 | -------------------------------------------------------------------------------- /src/SAME70xpld/Pins_SAME70xpld.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Pins_DuetNG.cpp 3 | * 4 | * Created on: 31 Mar 2019 5 | * Author: David 6 | */ 7 | 8 | #include "RepRapFirmware.h" 9 | 10 | // Hardware-dependent pins functions 11 | 12 | // Function to look up a pin name pass back the corresponding index into the pin table 13 | // On this platform, the mapping from pin names to pins is fixed, so this is a simple lookup 14 | bool LookupPinName(const char*pn, LogicalPin& lpin, bool& hardwareInverted) 15 | { 16 | if (StringEqualsIgnoreCase(pn, NoPinName)) 17 | { 18 | lpin = NoLogicalPin; 19 | hardwareInverted = false; 20 | return true; 21 | } 22 | 23 | for (size_t lp = 0; lp < ARRAY_SIZE(PinTable); ++lp) 24 | { 25 | const char *q = PinTable[lp].names; 26 | while (*q != 0) 27 | { 28 | // Try the next alias in the list of names for this pin 29 | const char *p = pn; 30 | bool hwInverted = (*q == '!'); 31 | if (hwInverted) 32 | { 33 | ++q; 34 | } 35 | while (*q != ',' && *q != 0 && *p == *q) 36 | { 37 | ++p; 38 | ++q; 39 | } 40 | if (*p == 0 && (*q == 0 || *q == ',')) 41 | { 42 | // Found a match 43 | lpin = (LogicalPin)lp; 44 | hardwareInverted = hwInverted; 45 | return true; 46 | } 47 | 48 | // Skip to the start of the next alias 49 | while (*q != 0 && *q != ',') 50 | { 51 | ++q; 52 | } 53 | if (*q == ',') 54 | { 55 | ++q; 56 | } 57 | } 58 | } 59 | return false; 60 | } 61 | 62 | // End 63 | -------------------------------------------------------------------------------- /src/Storage/CRC32.h: -------------------------------------------------------------------------------- 1 | #ifndef CRC32_H 2 | #define CRC32_H 3 | 4 | #include 5 | 6 | class CRC32 7 | { 8 | private: 9 | uint32_t crc; 10 | 11 | public: 12 | CRC32() noexcept; 13 | void Update(char c) noexcept; 14 | void Update(const char *c, size_t len) noexcept; 15 | void Reset() noexcept; 16 | uint32_t Get() const noexcept; 17 | }; 18 | 19 | inline uint32_t CRC32::Get() const noexcept 20 | { 21 | return ~crc; 22 | } 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /src/TaskPriorities.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TaskPriorities.h 3 | * 4 | * Created on: 23 Oct 2019 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_TASKPRIORITIES_H_ 9 | #define SRC_TASKPRIORITIES_H_ 10 | 11 | // Task priorities 12 | namespace TaskPriority 13 | { 14 | static constexpr int IdlePriority = 0; 15 | static constexpr int SpinPriority = 1; // priority for tasks that rarely block 16 | #if defined(LPC_NETWORKING) 17 | static constexpr int TcpPriority = 2; 18 | //EMAC priority = 3 defined in FreeRTOSIPConfig.h 19 | static constexpr int HeatPriority = 4; 20 | static constexpr int SensorsPriority = 4; 21 | static constexpr int AinPriority = 4; 22 | static constexpr int HeightFollowingPriority = 4; 23 | static constexpr int LaserPriority = 5; 24 | #else 25 | static constexpr int HeatPriority = 2; 26 | static constexpr int SensorsPriority = 2; 27 | static constexpr int TmcPriority = 2; 28 | static constexpr int AinPriority = 2; 29 | static constexpr int HeightFollowingPriority = 2; 30 | static constexpr int DueXPriority = 3; 31 | static constexpr int LaserPriority = 3; 32 | static constexpr int CanSenderPriority = 3; 33 | static constexpr int CanReceiverPriority = 3; 34 | static constexpr int CanClockPriority = 3; 35 | static constexpr int EthernetPriority = 3; 36 | #endif 37 | } 38 | 39 | #endif /* SRC_TASKPRIORITIES_H_ */ 40 | -------------------------------------------------------------------------------- /src/Tasks.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Startup.h 3 | * 4 | * Created on: 26 Mar 2018 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_TASKS_H_ 9 | #define SRC_TASKS_H_ 10 | 11 | #include "RepRapFirmware.h" 12 | #include "MessageType.h" 13 | #include "RTOSIface/RTOSIface.h" 14 | 15 | namespace Tasks 16 | { 17 | void Diagnostics(MessageType mtype) noexcept; 18 | uint32_t GetNeverUsedRam() noexcept; 19 | const Mutex *GetSpiMutex() noexcept; 20 | const Mutex *GetI2CMutex() noexcept; 21 | const Mutex *GetSysDirMutex() noexcept; 22 | } 23 | 24 | #endif /* SRC_TASKS_H_ */ 25 | -------------------------------------------------------------------------------- /src/Tools/Filament.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Filament.h 3 | * 4 | * Created on: 13 Jun 2017 5 | * Author: Christian 6 | */ 7 | 8 | #ifndef SRC_TOOLS_FILAMENT_H 9 | #define SRC_TOOLS_FILAMENT_H 10 | 11 | #include 12 | 13 | const size_t FilamentNameLength = 32; 14 | 15 | 16 | class Filament 17 | { 18 | public: 19 | Filament(int extr) noexcept; 20 | 21 | int GetExtruder() const noexcept { return extruder; } // Returns the assigned extruder drive 22 | const char *GetName() const noexcept { return name; } // Returns the name of the currently loaded filament 23 | 24 | // TODO: Add support for filament counters, tool restrictions etc. 25 | // These should be stored in a dedicate file per filament directory like /filaments//filament.json 26 | 27 | bool IsLoaded() const noexcept { return (name[0] != 0); } // Returns true if a valid filament is assigned to this instance 28 | void Load(const char *filamentName) noexcept; // Loads filament parameters from the SD card 29 | void Unload() noexcept; // Unloads the current filament 30 | 31 | void LoadAssignment() noexcept; // Read the assigned material for the given extruder from the SD card 32 | 33 | static void SaveAssignments() noexcept; // Rewrite the CSV file containing the extruder <-> filament assignments 34 | static bool IsInUse(const char *filamentName) noexcept; // Check if this material is already assigned to an extruder 35 | static Filament *GetFilamentByExtruder(const int extruder) noexcept; // Retrieve the Filament instance assigned to the given extruder drive 36 | 37 | private: 38 | static const char * const FilamentAssignmentFile; // In which file the extruder <-> filament assignments are stored 39 | static const char * const FilamentAssignmentFileComment; // The comment we write at the start of this file to ensure its integrity 40 | 41 | static Filament *filamentList; 42 | Filament *next; 43 | 44 | int extruder; 45 | char name[FilamentNameLength]; 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/Tools/Spindle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Spindle.h 3 | * 4 | * Created on: Mar 21, 2018 5 | * Author: Christian 6 | */ 7 | 8 | #ifndef SPINDLE_H 9 | #define SPINDLE_H 10 | 11 | #include "RepRapFirmware.h" 12 | #include "Hardware/IoPorts.h" 13 | #include "ObjectModel/ObjectModel.h" 14 | 15 | class Spindle INHERIT_OBJECT_MODEL 16 | { 17 | private: 18 | PwmPort spindleForwardPort, spindleReversePort; 19 | float currentRpm, configuredRpm, maxRpm; 20 | PwmFrequency frequency; 21 | int toolNumber; 22 | 23 | protected: 24 | DECLARE_OBJECT_MODEL 25 | 26 | public: 27 | Spindle() noexcept : currentRpm(0.0), configuredRpm(0.0), maxRpm(DefaultMaxSpindleRpm), frequency(0), toolNumber(-1) { } 28 | 29 | bool AllocatePins(GCodeBuffer& gb, const StringRef& reply) noexcept; // Allocate the pins returning true if successful 30 | 31 | void SetFrequency(PwmFrequency freq) noexcept; 32 | 33 | int GetToolNumber() const noexcept { return toolNumber; } 34 | void SetToolNumber(int tool) noexcept { toolNumber = tool; } 35 | 36 | void SetMaxRpm(float max) noexcept { maxRpm = max; } 37 | 38 | float GetCurrentRpm() const noexcept { return currentRpm; } 39 | float GetRpm() const noexcept { return configuredRpm; } 40 | void SetRpm(float rpm) noexcept; 41 | 42 | void TurnOff() noexcept; 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/Version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Version.h 3 | * 4 | * Created on: 25 Dec 2016 5 | * Author: David 6 | */ 7 | 8 | #ifndef SRC_VERSION_H_ 9 | #define SRC_VERSION_H_ 10 | 11 | #ifndef VERSION 12 | # define MAIN_VERSION "3.1.1" 13 | # ifdef USE_CAN0 14 | # define VERSION_SUFFIX " (CAN0)" 15 | # else 16 | # define VERSION_SUFFIX "" 17 | # endif 18 | # define VERSION MAIN_VERSION VERSION_SUFFIX 19 | #endif 20 | 21 | #ifndef DATE 22 | # define DATE "2020-05-19b2" 23 | #endif 24 | 25 | #define AUTHORS "reprappro, dc42, chrishamm, t3p3, dnewman, printm3d" 26 | 27 | #endif /* SRC_VERSION_H_ */ 28 | -------------------------------------------------------------------------------- /src/libc/local.h: -------------------------------------------------------------------------------- 1 | #include <_ansi.h> 2 | 3 | #if 0 // dc42 4 | #include <../ctype/local.h> 5 | 6 | /* internal function to compute width of wide char. */ 7 | int __wcwidth (wint_t); 8 | #endif 9 | 10 | /* 11 | Taken from glibc: 12 | Add the compiler optimization to inhibit loop transformation to library 13 | calls. This is used to avoid recursive calls in memset and memmove 14 | default implementations. 15 | */ 16 | #ifdef _HAVE_CC_INHIBIT_LOOP_TO_LIBCALL 17 | # define __inhibit_loop_to_libcall \ 18 | __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns"))) 19 | #else 20 | # define __inhibit_loop_to_libcall 21 | #endif 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/libc/readme-libc.txt: -------------------------------------------------------------------------------- 1 | README file for libc folder 2 | =========================== 3 | 4 | On ARM Cortex M7 processors, accesses to strongly-ordered memory such as our "nocache" RAM segment must be aligned. Therefore we compile with option -fno-unaligned-access. 5 | Unfortunately, newlib (the standard C library) isn't compiled with -fno-unaligned-access, and memcpy in particular sometimes does unaligned accesses. 6 | To fix this, we include our own copy of memcpy here. Similarly for other memory-related functions that might be used to access DMA buffers. 7 | 8 | strptime.c in this folder is a cut-down version that doesn't need a locale, saving about 360 bytes of RAM. This is sufficient for RepRapFirmware because we don't 9 | need to recognise month or day names. 10 | 11 | DC 2020-01-10 12 | -------------------------------------------------------------------------------- /src/libc/strptime.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sdavi/RepRapFirmware/374100d1498cf62eab9f571e048a7358b575f994/src/libc/strptime.cpp -------------------------------------------------------------------------------- /src/libcpp/readme-libcpp.txt: -------------------------------------------------------------------------------- 1 | README file for libcpp folder 2 | ============================= 3 | 4 | The folder contains files from GNU libsupc++. THEY MUST BE KEP UP-TO-DATE WITH THE ONES IN THE libsupc++ LIBRARY!!! 5 | 6 | File eh-alloc.cpp is a modified version of the original GNU one which doesn't maintain an emergency buffer tool for 7 | allocating exception objects if allocation using malloc() mfails. This saves more than 2K dynamic RAM. 8 | 9 | File unwind-cxx.h is an include file needed by eh_alloc.cpp, unmodified from the original. 10 | 11 | DC 2020-01-10 12 | -------------------------------------------------------------------------------- /src/libcpp/vterminate.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * vterminate.cc 3 | * 4 | * Created on: 22 Jan 2020 5 | * Author: David 6 | */ 7 | 8 | #include 9 | 10 | namespace __gnu_cxx 11 | { 12 | // A replacement for the standard terminate_handler which prints 13 | // more information about the terminating exception (if any) on 14 | // stderr. 15 | void __verbose_terminate_handler() 16 | { 17 | abort(); 18 | } 19 | } 20 | 21 | // End 22 | --------------------------------------------------------------------------------