Skip to content

Instantly share code, notes, and snippets.

View triffid's full-sized avatar

Michael Moon triffid

View GitHub Profile
@triffid
triffid / async_fat.c
Last active December 28, 2015 02:29
async fat description
/*
* Operation of Asynchronous FAT:
*
* All calls return immediately. We NEVER busyloop, waiting for data
*
* Whenever new data is required, we request a DMA transfer and return
*
* We maintain a queue of tasks. External tasks (eg open, read, readdir) are
* placed at the bottom of the queue.
* Internal tasks (eg traverse FAT, read directory, etc) are placed at the
@triffid
triffid / Makefile
Last active December 26, 2015 18:08
polled streams proof of concept
PROJECT = silken
FLAGS=-Wall -ffunction-sections -fdata-sections -g
CFLAGS=$(FLAGS) -std=gnu99 -g
CXXFLAGS=$(FLAGS) -std=gnu++0x
LDFLAGS=$(FLAGS) -Wl,-gc-sections
CC=gcc
CPP=g++
@triffid
triffid / test_MemoryPool.cpp
Last active December 17, 2015 06:18
memorypool test program
// g++ -g -DMEMDEBUG -o test test.cpp MemoryPool.cpp && ./test
#include <stdio.h>
#include <stdlib.h>
#include "MemoryPool.h"
class T1 {
public:
T1(){
@triffid
triffid / RostockSolution.cpp
Last active December 13, 2015 16:49
smoothie rostock random scribble
#include "RostockSolution.h"
#include <math.h>
#define X_AXIS 0
#define Y_AXIS 1
#define Z_AXIS 2
RostockSolution::RostockSolution(Config* passed_config) : config(passed_config){
alpha_steps_per_mm = passed_config->value(alpha_steps_per_mm_checksum)->by_default(80)->as_number();
beta_steps_per_mm = passed_config->value( beta_steps_per_mm_checksum)->by_default(80)->as_number();
@triffid
triffid / config_pattern.c
Last active December 12, 2015 04:08
proposed Smoothie config pattern
/** Intended design pattern: */
class ModulePool : public Module {
std::map<const char*,Module*> children; // list of name->Module pairs which are children of this ModulePool
};
class ConfigKey {
public:
ConfigKey(); // empty key, use for retrieving config settings
ConfigKey(const char* line); // extract key and value from the provided line
diff --git a/src/modules/robot/Robot.cpp b/src/modules/robot/Robot.cpp
index 3dcb7bb..c4bf877 100644
--- a/src/modules/robot/Robot.cpp
+++ b/src/modules/robot/Robot.cpp
@@ -112,10 +112,7 @@ void Robot::execute_gcode(Gcode* gcode){
case 91: this->absolute_mode = false; break;
case 92: {
if(gcode->get_num_args() == 0){
- for (char letter = 'X'; letter <= 'Z'; letter++){
- if ( gcode->has_letter(letter) )
@triffid
triffid / smoothie config design pattern.c
Created January 2, 2013 23:20
smoothie config design pattern
/*
* intended design pattern:
*
* void YourModule::on_config_value(void *argument)
* {
* ConfigValue* value = staticcast<ConfigValue*>(argument);
* if (value->is_for_me(my_string))
* {
* if (value->is_for_my_submodule())
* {
@triffid
triffid / log.txt
Created December 26, 2012 00:45
smoothie live config weirdness
M105
T:28.0 /200.0 B:-58.0 /0.0
ok
config-set alpha_current 1.25
config-get alpha_current
M105
live: alpha_curtconfig-get has been set to alpha_currM105
M105
T:28.0 /200.0 B:-58.0 /0.0
ok
@triffid
triffid / main.elf
Created December 20, 2012 08:41
smoothie crash dump
This file has been truncated, but you can view the full file.
@triffid
triffid / lsusb
Created December 15, 2012 10:23
Smoothie DFU Bootloader descriptors
$ lsusb
Bus 001 Device 023: ID 1679:2001 Total Phase Beagle USB 12 Protocol Analyzer
Bus 002 Device 004: ID 0930:0508 Toshiba Corp. Integrated Bluetooth HCI
Bus 002 Device 003: ID 0483:2016 SGS Thomson Microelectronics Fingerprint Reader
Bus 003 Device 046: ID 1d50:6015 OpenMoko, Inc.
Bus 003 Device 122: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
Bus 004 Device 030: ID 046d:c404 Logitech, Inc. TrackMan Wheel
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub