some compatibility fixes and upload instructions

This commit is contained in:
Filip Ayazi 2021-06-02 00:56:23 +01:00
parent 35d969aadd
commit edd0246cc5
6 changed files with 43 additions and 7 deletions

View file

@ -11,11 +11,20 @@ The code is split into the main part which mostly handles command parsing and mo
Motor moves now do not block command processing and a new command `stop` was added which aborts any move in progress.
The firware can be build against different platforms (pi pico, stm32). `boards.h` contains wiring configuration which will need to be adjusted when used with a custom board.
## Hardware
This is mainly intended for Sangaboard control boards and all configuration for these is already in `boards.h`, but it can also be used on different platforms (pi pico, stm32 (bluepill)). To use a custom board based on any of these platforms adjust `boards.h` to match your wiring.
Currently works on Arduino Nano + Sangaboard v0.2. Other platforms might work with appropriate `platform.ini` and `config.h` changes and will be supported in due course.
If you have additional hardware connected to the board (Endstops, Light sensor) support for these can be enabled in `config.h`.
## Building and uploading
The easiest way to build and upload this firmware is to install `pio core` via pip. For arduino nano with sangaboard v0.2 run
```
pip3 install platformio
pio lib install
pio run -e nano
pio run -e nano -t upload
```
for sangaboard v0.3 replace `nano` with `leonardo` in the above commands (untested).
## TODO list

View file

@ -10,13 +10,13 @@
#define MAX_COMMANDS 50
#define MAX_MODULES 10
#define MAX_ARGUMENT_LENGTH 20 //used in argument parsing, takes up ram
#define VERSION_STRING "Sangaboard Firmware v0.6"
#define VERSION_STRING "Sangaboard Firmware v0.5" //TODO: temporarily using the same version string for sangaboard.py compatibility
#define DEBUG_ON
//module choice
#define HELP
#define STAGE
#define ENDSTOPS
// #define ENDSTOPS
// #define LIGHT_SENSOR
//module configs

View file

@ -44,6 +44,7 @@ uint8_t registered_loop_fn_count = 0;
const Command core_commands[] = {
{"version", get_version},
{"list_modules", get_modules},
END_COMMAND};
void register_module(const Command commands[], void (*loop_fn)(void))
@ -95,10 +96,34 @@ uint8_t parse_arguments(char ** arguments, String command, uint8_t max_args)
void get_version(String)
{
Serial.println(F(VER_STRING));
Serial.println(F(VERSION_STRING));
return;
}
void get_modules(String)
{
#if defined(LIGHTSENSOR) && defined(LIGHT_SENSOR_ADAFRUIT_TSL2591)
Serial.println(F("Light Sensor: TSL2591"));
#elif defined(LIGHTSENSOR) && defined(LIGHT_SENSOR_ADAFRUIT_ADS1115)
Serial.println(F("Light Sensor: ADS1115"));
#endif
#if defined(ENDSTOPS)
Serial.print("Endstops:");
#ifdef ENDSTOPS_MIN
Serial.print(" min");
#endif
#ifdef ENDSTOPS_MAX
Serial.print(" max");
#endif
#ifdef ENDSTOPS_SOFT
Serial.print(" soft");
#endif
Serial.println();
#endif
Serial.println("--END--");
}
#ifndef UNIT_TEST
void setup()
{

View file

@ -23,5 +23,6 @@ uint8_t parse_arguments(char ** arguments, String, uint8_t);
extern void register_module(const Command commands[], void (*loop_fn)(void));
void get_version(String);
void get_modules(String);
#define MAIN_H
#endif

View file

@ -110,6 +110,7 @@ void start_move(long displ[n_motors])
move_start_time = micros();
final_scaled_t = (float)max_steps * min_step_delay; //NB total time taken will be final_scaled_t + 2*ramp_time
stage_moving = true;
Serial.println("done.");
}
void stage_loop()
@ -209,6 +210,7 @@ void stage_release(String command)
{
releaseMotor(i);
}
Serial.println("done");
}
void stage_p(String command)

View file

@ -4,7 +4,6 @@
#include <Arduino.h>
#define EACH_MOTOR for (int i = 0; i < STAGE_N_MOTORS; i++)
#define VER_STRING "Sangaboard Firmware v0.6"
void stage_setup();
void stage_loop();