Skip to content

Instantly share code, notes, and snippets.

@devyte
devyte / AccelLimiter.h
Last active September 24, 2020 23:08
Stepper accel limiter
class AccelLimiter
{
public:
int accel; // unit is Hz/s, i.e.: pulses/s2, always positive
int maxAccel; //this is the physical limitation. A frequency change above this value between consecutive updates is not allowed. Always positive.
AccelLimiter(int accel, int maxAccel)
: accel(accel), maxAccel(maxAccel)
{
}
@devyte
devyte / stepperapi.cpp
Last active August 28, 2020 03:17
Multichannel Stepper speed api based on waveform generator
#include "stepperapi.h"
#include "Arduino.h"
#include "core_esp8266_waveform.h"
static bool
stepperStartCore(int pinPulse, uint32_t analogFreq)
{
if (analogFreq == 0)
return stopWaveform(pinPulse); //for frequency = 0, stop the pulse train
@devyte
devyte / integrating-fastbuild-with-ue4.md
Created August 15, 2020 04:41 — forked from hillin/integrating-fastbuild-with-ue4.md
Integrating FASTBuild with Unreal Engine 4

FASTBuild is an open-source distributed build system, which could be a free alternative to Incredibuild. Unreal Engine 4 (UE4) does not support FASTBuild natively, however it's not hard to integrate it manually.

Integrate FASTBuild with UE4

Install FASTBuild

We assume you already have the full UE4 source code. First you'll need to grab the latest FASTBuild tools from here. We use v0.93 Windows x64 version in this tutorial. Download it and extract all the files. Here you have several choices:

  • Place the files under any folder which could be found with your system's PATH environment variable. To see where these folders are, run the PATH command in a command prompt window;
  • Place the files under the Engine\Binaries\ThirdParty\FASTBuild folder of your engine. This is the recommended place;
  • Place the files anywhere you like. This is not recommended because you'll have to hard-code the path later.
@devyte
devyte / UdpReentrancyIssue. cpp
Last active June 15, 2020 02:53
Udp Reentrancy Issue due to endPacketMayRetry() and scheduled functions
#include "Arduino.h"
WiFiUdp Udp;
Ticker pingAlive;
void pingAliveFunction()
{
Udp.beginPacket("watchdog.host.net", 12345);
Udp.write("I'm still alive you dolt");
@devyte
devyte / preprocessor_fun.h
Created April 25, 2020 06:17 — forked from aras-p/preprocessor_fun.h
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@devyte
devyte / i2c_master.cpp
Last active November 15, 2019 02:40
i2c_slave.cpp
void SDAcallback(void) __attribute__((weak));
void SDAcallback(void)
{
//weak functiom, used only whwn pure-master case is used. When slave is linked in, this function
//gets replaced by a strong-attributed one that is empty.
//Master collision detection logic goes here
//...
}
@devyte
devyte / Ethernet5100.h
Created October 4, 2019 03:10
ethernet network
#include "Network.h"
namespace Ethernet5100
{
class EthernetClass
{
@devyte
devyte / IfList.h
Created November 27, 2018 03:08
IfList implementation with separate objects
#ifndef __IFLIST_H__
#define __IFLIST_H__
struct NetInterface
{
NetInterface(_netif *netif) : _netif(netif), _num(-1) {}
NetInterface(const NetInterface & o) : _netif(o.netif), _num(o._num) {}
bool isLegacy() const { return _num == 0; }
struct storeArgHandler
{
void operator(RequestArgument &arg, const String & data, int pos, int key_end_pos) //args are local vars
{
arg.key = urlDecode(data.substring(pos, key_end_pos));
if ( (equal_index != -1) && ( (equal_index < next_index - 1) || (next_index == -1)) )
arg.value = urlDecode(data.substring(equal_index + 1, next_index - 1));
#ifdef DEBUG_ESP_HTTP_SERVER #ifdef DEBUG_ESP_HTTP_SERVER
#include "Arduino.h"
#include "timeout.h"
void runtest1()
{
using namespace esp8266;
polledTimeoutOneShot timeout(3000);
Serial.print("before while 1\n");
while(!timeout.expired())