...
 
......@@ -5,3 +5,5 @@ Sweep_Notes
wheels_default.jsw
src
lib/*
.pioenvs
.piolibdeps
/* vim: set syntax=c expandtab sw=2 softtabstop=2 autoindent smartindent smarttab : */
/*
* Arbritrary wheel pattern generator
* vim: filetype=c expandtab shiftwidth=2 tabstop=2 softtabstop=2:
*
* copyright 2014 David J. Andruczyk
* Arbritrary crank/cam wheel pattern generator
*
* copyright 2014-2017 David J. Andruczyk
*
* Ardu-Stim software is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
......@@ -26,6 +27,7 @@
#include "user_defaults.h"
#include <inttypes.h>
#include <Arduino.h>
#include <SerialUI.h>
/* Sensistive stuff used in ISR's */
extern volatile uint8_t fraction;
......@@ -151,12 +153,20 @@ ISR(TIMER2_COMPA_vect) {
// PORTD = (0 << 7);
return;
}
if (sweep_lock) // semaphore to protect around changes/critical sections
/* IF the sweep parameters are being changed, abort the ISR so we
* don't use half-set values and get things really screwed up
*/
if (sweep_lock)
{
// PORTD = (0 << 7);
return;
}
sweep_lock = true;
sweep_lock = true; /* Set semaphore */
/* Check flag to see if we need to reset the prescaler for the timer.
* if so, clear that flag, set another for the high speed ISR to check for
* and reprogram the timer when it next runs. Store the last prescaler bits
* for comparison against during sweep stage changes
*/
if (sweep_reset_prescaler)
{
sweep_reset_prescaler = false;
......@@ -167,24 +177,45 @@ ISR(TIMER2_COMPA_vect) {
/* Sweep code */
if (sweep_direction == ASCENDING)
{
oc_remainder += SweepSteps[sweep_stage].remainder_per_isr;
/* IF the total is over the threshold we increment the TCNT factor
* for each multiple it is over by
/* So we don't have to work in floating point (super expensive and slow)
* we work in a larger scale and keep the remainder per ISR around as
* an integer, when that overcomes the threshold we increment the
* fractional component and decrement the remainder by that same threshold
*/
oc_remainder += SweepSteps[sweep_stage].remainder_per_isr;
while (oc_remainder > FACTOR_THRESHOLD)
{
fraction++;
oc_remainder -= FACTOR_THRESHOLD;
}
/* new_OCR1A is the new Output Compare Register (1a) value, it
* determines how long it is between each tooth interrupt. The longer
* it is the LOWER the RPM of hte signal will be. NOTE: this value
* goes hand in hand with the prescaler, as that determines the divisor
* for the clock, so you need to take both of them into account
* tcnt_per_isr is the tooth count CHANGE per ISR (accelerating or
* decelerating depending on sweep direction). Since we're in the
* ascending side (RPM going up, OCR1A going down) we will be reducing
* new_OCR1A by tcnt_per_isr + whatever fractional amount until it's
* below the ending_ocr value, at that point this stage is completed
* and we increment the stage.
*/
if (new_OCR1A > SweepSteps[sweep_stage].ending_ocr)
{
new_OCR1A -= (SweepSteps[sweep_stage].tcnt_per_isr + fraction);
fraction = 0;
}
/* Stage endd, increament stage counter, reset remainder to 0 */
else /* END of the stage, find out where we are */
{
sweep_stage++;
oc_remainder = 0;
/* Check if there's a next stage by making sure we're not over the end,
* if so, then reset new_OCR1A to the beginning value from the
* structure, check if hte prescaler bits need to change, if they do
* we set a flag to do so on the next ISR iteration (1ms later)
*/
if (sweep_stage < total_sweep_stages)
{
/* Toggle when changing stages */
......@@ -194,6 +225,11 @@ ISR(TIMER2_COMPA_vect) {
if (SweepSteps[sweep_stage].prescaler_bits != last_prescaler_bits)
sweep_reset_prescaler = true;
}
/* End of sweep stages, reverse direction, decrement sweep_stage by one
* Set the direction flag to descending, Reset new_OCR1A to the end
* value (remember opposite direction!), Check prescaler bits and
* set flag to reset if necessary
*/
else /* END of line, time to reverse direction */
{
sweep_stage--; /*Bring back within limits */
......@@ -201,11 +237,15 @@ ISR(TIMER2_COMPA_vect) {
new_OCR1A = SweepSteps[sweep_stage].ending_ocr;
if (SweepSteps[sweep_stage].prescaler_bits != last_prescaler_bits)
sweep_reset_prescaler = true;
PORTD |= 1 << 7; /* Debugginga, ascending */
//PORTD |= 1 << 7; /* Debugging, ascending */
}
/* Reset fractionals or next round */
}
}
/* Descending RPM, which means new_OCR1A should be CLIMBING,
* increment the oc_remainder, check if it's over the threshold, if
* so increment the fraction and decrement the remainder by the fraction.
*/
else /* Descending */
{
oc_remainder += SweepSteps[sweep_stage].remainder_per_isr;
......@@ -214,21 +254,37 @@ ISR(TIMER2_COMPA_vect) {
fraction++;
oc_remainder -= FACTOR_THRESHOLD;
}
/* Check if new_OCR1A is less than the sweep stage threshold, if it
* still is, increase new_OCR1A by the tooth count change per ISR and the
* fractional component
*/
if (new_OCR1A < SweepSteps[sweep_stage].beginning_ocr)
{
new_OCR1A += (SweepSteps[sweep_stage].tcnt_per_isr + fraction);
fraction = 0;
}
/* new_OCR1A has exceeded the OCR threshold, decrement the sweep stage,
* reset the remainder to 0 an check to make sure sweep_stage hasn't gone
* below zero
*/
else /* End of stage */
{
sweep_stage--;
oc_remainder = 0;
/* Check that sweep_stage hasn't gone negative, if not, reset
* new_OCR1a to the starting value for this stage, check prescaler
* bits against last ones and set flag if needed
*/
if (sweep_stage >= 0)
{
new_OCR1A = SweepSteps[sweep_stage].ending_ocr;
if (SweepSteps[sweep_stage].prescaler_bits != last_prescaler_bits)
sweep_reset_prescaler = true;
}
/* Sweep stage went negative, bring it back to zero, flip the direction
* back to ASCENDING, reset new_OCR1A to starting value for this stage
* and check prescaler bits and set flag to update if needed
*/
else /*End of the line */
{
sweep_stage++; /*Bring back within limits */
......
/* vim: set syntax=c expandtab sw=2 softtabstop=2 autoindent smartindent smarttab : */
/*
* Arbritrary wheel pattern generator
* vim: filetype=c expandtab shiftwidth=2 tabstop=2 softtabstop=2:
*
* copyright 2014 David J. Andruczyk
* Arbritrary crank/cam wheel pattern generator
*
* copyright 2014-2017 David J. Andruczyk
*
* Ardu-Stim software is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
......
/* vim: set syntax=c expandtab sw=2 softtabstop=2 autoindent smartindent smarttab : */
/*
* Arbritrary wheel pattern generator
* vim: filetype=c expandtab shiftwidth=2 tabstop=2 softtabstop=2:
*
* copyright 2014 David J. Andruczyk
* Arbritrary crank/cam wheel pattern generator
*
* copyright 2014-2017 David J. Andruczyk
*
* Ardu-Stim software is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -28,7 +29,7 @@
#include <avr/pgmspace.h>
#include <SerialUI.h>
/* Sensistive stuff used in ISR's */
/* Sensitive stuff used in ISR's */
volatile uint8_t fraction = 0;
volatile uint8_t selected_wheel = DEFAULT_WHEEL;
volatile uint16_t adc0; /* POT RPM */
......@@ -59,12 +60,12 @@ uint16_t sweep_low_rpm = 0;
uint16_t sweep_high_rpm = 0;
uint16_t sweep_rate = 0;
SUI::SerialUI mySUI = SUI::SerialUI(greeting);
SUI::SerialUI mySUI = SUI::SerialUI();
sweep_step *SweepSteps; /* Global pointer for the sweep steps */
/* Initialization */
void setup() {
mySUI.setGreeting(F("+++ Welcome to the ArduStim +++\r\nEnter ? for help"));
extern unsigned long wanted_rpm;
serial_setup();
......
/* vim: set syntax=c expandtab sw=2 softtabstop=2 autoindent smartindent smarttab : */
/*
* Arbritrary wheel pattern generator wheel definitions
* vim: filetype=c expandtab shiftwidth=2 tabstop=2 softtabstop=2:
*
* copyright 2014 David J. Andruczyk
* Arbritrary crank/cam wheel pattern generator
*
* copyright 2014-2017 David J. Andruczyk
*
* Ardu-Stim software is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -18,6 +19,7 @@
* along with any ArduStim software. If not, see http://www.gnu.org/licenses/
*
*/
#ifndef __DEFINES_H__
#define __DEFINES_H__
......@@ -26,8 +28,7 @@
#define TMP_RPM_SHIFT 4 /* x16, 0-16384 RPM via pot */
#define TMP_RPM_CAP 16384 /* MAX RPM via pot control */
#define FACTOR_THRESHOLD 1000000
#define MORE_LINEAR_SWEEP 1
#define SUI_NO_INCLUDE_EXTRA_SAFETYCHECKS
//#define SUI_NO_INCLUDE_EXTRA_SAFETYCHECKS
#define LOG_2 0.30102999566
#endif
/* vim: set syntax=c expandtab sw=2 softtabstop=2 autoindent smartindent smarttab : */
/*
* Arbritrary wheel pattern generator wheel definitions
* vim: filetype=c expandtab shiftwidth=2 tabstop=2 softtabstop=2:
*
* copyright 2014 David J. Andruczyk
* Arbritrary crank/cam wheel pattern generator
*
* copyright 2014-2017 David J. Andruczyk
*
* Ardu-Stim software is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -18,6 +19,7 @@
* along with any ArduStim software. If not, see http://www.gnu.org/licenses/
*
*/
#ifndef __ENUMS_H__
#define __ENUMS_H__
......
/*
* vim: filetype=c expandtab shiftwidth=2 tabstop=2 softtabstop=2:
*
* Arbritrary crank/cam wheel pattern generator
*
* copyright 2014-2017 David J. Andruczyk
*
* Ardu-Stim software is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ArduStim software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with any ArduStim software. If not, see http://www.gnu.org/licenses/
*
*/
#include <SerialUI.h>
#include "defines.h"
......@@ -7,9 +28,9 @@
extern SUI::SerialUI mySUI;
void loop() {
uint16_t tmp_rpm = 0;
extern volatile bool adc0_read_complete;
extern volatile uint16_t adc0;
//uint16_t tmp_rpm = 0;
//extern volatile bool adc0_read_complete;
//extern volatile uint16_t adc0;
/* Just handle the Serial UI, everything else is in
* interrupt handlers or callbacks from SerialUI.
*/
......
/* ex: filetype=c expandtab shiftwidth=2 tabstop=2 softtabstop=2: */
/*
* vim: filetype=c expandtab shiftwidth=2 tabstop=2 softtabstop=2:
*
* Arbritrary crank/cam wheel pattern generator
*
* copyright 2014-2016 David J. Andruczyk
* copyright 2014-2017 David J. Andruczyk
*
* Ardu-Stim software is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......
/* vim: set syntax=c expandtab sw=2 softtabstop=2 autoindent smartindent smarttab : */
/*
* Arbritrary wheel pattern generator
* vim: filetype=c expandtab shiftwidth=2 tabstop=2 softtabstop=2:
*
* copyright 2014 David J. Andruczyk
* Arbritrary crank/cam wheel pattern generator
*
* copyright 2014-2017 David J. Andruczyk
*
* Ardu-Stim software is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -45,7 +46,7 @@ extern uint16_t sweep_rate;
/* Volatile variables (USED in ISR's) */
extern volatile uint8_t selected_wheel;
extern volatile uint8_t sweep_direction;
extern volatile uint8_t sweep_stage;
extern volatile int8_t sweep_stage;
extern volatile bool normal;
extern volatile bool sweep_lock;
extern volatile bool sweep_reset_prescaler;
......@@ -72,26 +73,27 @@ void serial_setup()
SUI::Menu *advMenu;
/* Simple all on one menu... */
/* Menu strungs are in the header file */
mainMenu->setName(top_menu_title);
mainMenu->addCommand(info_key,show_info_cb,info_help);
mainMenu->addCommand(rpm_key,set_rpm_cb,rpm_key);
mainMenu->addCommand(sweep_key,sweep_rpm_cb,sweep_help);
wheelMenu = mainMenu->subMenu(wheel_menu_key,wheel_menu_help);
wheelMenu->addCommand(next_key,select_next_wheel_cb,next_help);
wheelMenu->addCommand(previous_key,select_previous_wheel_cb,previous_help);
wheelMenu->addCommand(list_key,list_wheels_cb,list_help);
wheelMenu->addCommand(choose_key,select_wheel_cb,choose_help);
advMenu = mainMenu->subMenu(advanced_menu_key,advanced_menu_help);
advMenu->addCommand(reverse_key,reverse_wheel_direction_cb,reverse_help);
advMenu->addCommand(pri_invert_key,toggle_invert_primary_cb,pri_invert_help);
advMenu->addCommand(sec_invert_key,toggle_invert_secondary_cb,sec_invert_help);
mainMenu->addCommand(exit_key, do_exit, exit_help);
mainMenu->setName(F("ArduStim Main Menu"));
mainMenu->addCommand(F("Information"),show_info_cb,F("Retrieve data and current settings"));
mainMenu->addCommand(F("Set Fixed RPM"),set_rpm_cb,F("Set Fixed RPM"));
mainMenu->addCommand(F("Set Swept RPM"),sweep_rpm_cb,F("Sweep the RPM (min,max,rate(rpm/sec))"));
wheelMenu = mainMenu->subMenu(F("Wheel Options"),F("Wheel Options, (list,choose,select)"));
wheelMenu->addCommand(F("Next wheel"),select_next_wheel_cb,F("Pick the next wheel pattern"));
wheelMenu->addCommand(F("Previous wheel"),select_previous_wheel_cb,F("Pick the previous wheel pattern"));
wheelMenu->addCommand(F("List wheels"),list_wheels_cb,F("List all wheel patterns"));
wheelMenu->addCommand(F("Choose wheel"),select_wheel_cb,F("Choose a specific wheel pattern by number"));
advMenu = mainMenu->subMenu(F("Advanced Options"),F("Advanced Options (polarity,glitch)"));
advMenu->addCommand(F("Reverse Wheel Direction"),reverse_wheel_direction_cb,F("Reverse the wheel's direction of rotation"));
advMenu->addCommand(F("Invert Primary"),toggle_invert_primary_cb,F("Invert Primary (crank) signal polarity"));
advMenu->addCommand(F("Invert Secondary"),toggle_invert_secondary_cb,F("Invert Secondary (cam) signal polarity"));
mainMenu->addCommand(F("Exit"), do_exit, F("Exit (and terminate Druid)"));
/* Not implemented yet */
//advMenu->addCommand(pri_glitch_key,primary_glitch_cb,pri_glitch_help);
//advMenu->addCommand(sec_glitch_key,secondary_glitch_cb,sec_glitch_help);
// mySUI.trackState(RPM, &wanted_rpm);
mySUI.trackState(fixed_RPM_mode, &fixed);
mySUI.trackState(swept_RPM_mode, &swept);
//These use way more memory than I would have hoped for... :(
//mySUI.trackState(F("RPM"), &wanted_rpm);
//mySUI.trackState(F("Fixed RPM"), &fixed);
//mySUI.trackState(F("Swept RPM"), &swept);
}
/* Helper function to spit out amount of ram remainig */
......@@ -112,11 +114,20 @@ void toggle_invert_primary_cb()
{
extern uint8_t output_invert_mask;
output_invert_mask ^= 0x01; /* Flip crank invert mask bit */
mySUI.print_P(primary_space_signal_colon_space);
if (output_invert_mask & 0x01)
mySUI.println_P(inverted_);
else
mySUI.println_P(normal_);
mySUI.print(F("Primary Signal: "));
if (output_invert_mask & 0x01) {
print_inverted();
}
else {
print_normal();
}
}
void print_normal() {
mySUI.println(F("Normal"));
}
void print_inverted() {
mySUI.println(F("Inverted"));
}
//! Inverts the polarity of the secondary output signal
......@@ -124,25 +135,25 @@ void toggle_invert_secondary_cb()
{
extern uint8_t output_invert_mask;
output_invert_mask ^= 0x02; /* Flip cam invert mask bit */
mySUI.print_P(secondary_space_signal_colon_space);
mySUI.print(F("Secondary Signal: "));
if (output_invert_mask & 0x02)
mySUI.println_P(inverted_);
print_inverted();
else
mySUI.println_P(normal_);
print_normal();
}
//! Returns info about status, mode and free RAM
void show_info_cb()
{
mySUI.println_P(info_title);
mySUI.print_P(free_ram);
mySUI.println(F("Welcome to ArduStim, written by David J. Andruczyk"));
mySUI.print(F("Free RAM: "));
mySUI.print(freeRam());
mySUI.println_P(bytes);
mySUI.println_P(current_pattern);
mySUI.println(F("bytes."));
mySUI.println(F("Currently selected Wheel pattern: "));
mySUI.print(selected_wheel+1);
mySUI.print_P(colon);
mySUI.println_P(Wheels[selected_wheel].decoder_name);
mySUI.print(F(":"));
mySUI.println((const __FlashStringHelper *)Wheels[selected_wheel].decoder_name);
display_rpm_info();
}
......@@ -151,19 +162,19 @@ void show_info_cb()
void display_rpm_info()
{
if (mode == FIXED_RPM) {
mySUI.print_P(fixed_current_rpm);
mySUI.print(F("Fixed RPM mode, Currently: "));
mySUI.print(wanted_rpm);
mySUI.print_P(space);
mySUI.println_P(RPM);
mySUI.println(F(" RPM"));
}
if (mode == LINEAR_SWEPT_RPM) {
mySUI.print_P(swept_rpm_from);
mySUI.print(F("Swept RPM mode From: "));
mySUI.print(sweep_low_rpm);
mySUI.print_P(arrows);
mySUI.print(F("<->"));
mySUI.print(sweep_high_rpm);
mySUI.print_P(space_at_colon_space);
mySUI.print(F(" at: "));
mySUI.print(sweep_rate);
mySUI.println_P(space_rpm_per_sec);
mySUI.println(F(" RPM/sec"));
}
}
//! Display newly selected wheel information
......@@ -179,10 +190,10 @@ void display_new_wheel()
else
compute_sweep_stages(&sweep_low_rpm, &sweep_high_rpm);
edge_counter = 0; // Reset to beginning of the wheel pattern */
mySUI.println_P(new_wheel_chosen);
mySUI.println(F("New Wheel chosen: "));
mySUI.print(selected_wheel + 1);
mySUI.print_P(colon_space);
mySUI.println_P(Wheels[selected_wheel].decoder_name);
mySUI.print(F(": "));
mySUI.println((const __FlashStringHelper *)Wheels[selected_wheel].decoder_name);
display_rpm_info();
}
......@@ -269,7 +280,7 @@ void set_rpm_cb()
reset_new_OCR1A(newRPM);
wanted_rpm = newRPM;
mySUI.print_P(new_rpm_chosen);
mySUI.print(F("New RPM chosen: "));
mySUI.println(wanted_rpm);
sweep_lock = false;
}
......@@ -285,8 +296,8 @@ void list_wheels_cb()
for (i=0;i<MAX_WHEELS;i++)
{
mySUI.print(i+1);
mySUI.print_P(colon_space);
mySUI.println_P((Wheels[i].decoder_name));
mySUI.print(F(": "));
mySUI.println((const __FlashStringHelper *)Wheels[i].decoder_name);
}
}
......@@ -298,16 +309,16 @@ void list_wheels_cb()
*/
void reverse_wheel_direction_cb()
{
mySUI.print_P(wheel_direction_colon_space);
mySUI.print(F("Wheel Direction: "));
if (normal)
{
normal = false;
mySUI.println_P(reversed_);
mySUI.println(F("Reversed"));
}
else
{
normal = true;
mySUI.println_P(normal_);
print_normal();
}
}
......@@ -337,9 +348,9 @@ void sweep_rpm_cb()
mySUI.showEnterDataPrompt();
j = mySUI.readBytesToEOL(sweep_buffer,20);
/* Debugging
mySUI.print_P(read_colon_space);
mySUI.print(F("Read: "));
mySUI.print(j);
mySUI.println_P(space_chars_from_user);
mySUI.println(F(" charactors from the user"));
*/
j = sscanf(sweep_buffer,"%i,%i,%i",&tmp_low_rpm,&tmp_high_rpm,&sweep_rate);
// Validate input ranges
......@@ -350,37 +361,33 @@ void sweep_rpm_cb()
(sweep_rate < 51200) &&
(tmp_low_rpm < tmp_high_rpm))
{
mySUI.print_P(sweeping_from_colon_space);
mySUI.print(F("Sweeping from: "));
mySUI.print(tmp_low_rpm);
mySUI.print_P(arrows);
mySUI.print(F("<->"));
mySUI.print(tmp_high_rpm);
mySUI.print_P(space_at_colon_space);
mySUI.print(F(" at: "));
mySUI.print(sweep_rate);
mySUI.println_P(space_rpm_per_sec);
mySUI.println(F(" RPM/sec"));
compute_sweep_stages(&tmp_low_rpm, &tmp_high_rpm);
}
else {
mySUI.returnError(range_error);
mySUI.returnError(F("Range error !(10-50000,10-50000,1-50000)!"));
}
}
void compute_sweep_stages(uint16_t *tmp_low_rpm, uint16_t *tmp_high_rpm)
{
uint8_t j;
uint8_t total_stages;
uint16_t end_tcnt;
uint32_t low_rpm_tcnt;
uint32_t high_rpm_tcnt;
uint16_t this_step_low_rpm;
uint16_t this_step_high_rpm;
uint16_t divisor;
uint16_t steps;
uint32_t scaled_remainder;
uint16_t rpm_span_this_stage;
float per_isr_tcnt_change;
float rpm_per_isr;
/* Spin until unlocked, then lock */
while (sweep_lock)
......
/* vim: set syntax=c expandtab sw=2 softtabstop=2 autoindent smartindent smarttab : */
/*
* Arbritrary wheel pattern generator wheel definitions
* vim: filetype=c expandtab shiftwidth=2 tabstop=2 softtabstop=2:
*
* copyright 2014 David J. Andruczyk
* Arbritrary crank/cam wheel pattern generator
*
* copyright 2014-2017 David J. Andruczyk
*
* Ardu-Stim software is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -18,6 +19,7 @@
* along with any ArduStim software. If not, see http://www.gnu.org/licenses/
*
*/
#ifndef __SERIAL_MENU_H__
#define __SERIAL_MENU_H__
......@@ -45,75 +47,10 @@ void do_exit(void);
void display_rpm_info(void);
void serial_setup(void);
void display_new_wheel(void);
void print_normal(void);
void print_inverted(void);
void compute_sweep_stages(uint16_t *, uint16_t *);
uint16_t get_rpm_from_tcnt(uint16_t *, uint8_t *);
uint8_t get_bitshift_from_prescaler(uint8_t *);
/* General functions */
/* Prototypes */
SUI_DeclareString(greeting,"+++ Welcome to the ArduStim +++\r\nEnter ? for help");
SUI_DeclareString(bytes, " bytes.");
SUI_DeclareString(top_menu_title,"ArduStim Main Menu");
SUI_DeclareString(info_key, "Information");
SUI_DeclareString(info_help, "Retrieve data and current settings");
SUI_DeclareString(rpm_key, "Set Fixed RPM");
SUI_DeclareString(sweep_key, "Set Swept RPM");
SUI_DeclareString(sweep_help, "Sweep the RPM (min,max,rate(rpm/sec))");
SUI_DeclareString(exit_key, "Exit");
SUI_DeclareString(exit_help, "Exit (and terminate Druid)");
SUI_DeclareString(wheel_menu_key, "Wheel Options");
SUI_DeclareString(wheel_menu_help, "Wheel Options, (list,choose,select)");
SUI_DeclareString(next_key, "Next wheel");
SUI_DeclareString(next_help, "Pick the next wheel pattern");
SUI_DeclareString(previous_key, "Previous wheel");
SUI_DeclareString(previous_help, "Pick the previous wheel pattern");
SUI_DeclareString(list_key, "List wheels");
SUI_DeclareString(list_help, "List all wheel patterns");
SUI_DeclareString(choose_key, "Choose wheel");
SUI_DeclareString(choose_help, "Choose a specific wheel pattern by number");
SUI_DeclareString(reverse_key, "Reverse Wheel Direction");
SUI_DeclareString(reverse_help, "Reverse the wheel's direction of rotation");
SUI_DeclareString(advanced_menu_key, "Advanced Options");
SUI_DeclareString(advanced_menu_help, "Advanced Options (polarity,glitch)");
SUI_DeclareString(pri_invert_key, "Invert Primary");
SUI_DeclareString(pri_invert_help, "Invert Primary (crank) signal polarity");
SUI_DeclareString(sec_invert_key, "Invert Secondary");
SUI_DeclareString(sec_invert_help, "Invert Secondary (cam) signal polarity");
/* Info callback */
SUI_DeclareString(info_title, "Welcome to ArduStim, written by David J. Andruczyk");
SUI_DeclareString(free_ram, "Free RAM: ");
SUI_DeclareString(colon, ":");
SUI_DeclareString(colon_space, ": ");
SUI_DeclareString(space, " ");
SUI_DeclareString(RPM, "RPM");
SUI_DeclareString(arrows, "<->");
SUI_DeclareString(read_colon_space, "Read: ");
SUI_DeclareString(space_to_colon_space, " to: ");
SUI_DeclareString(space_at_colon_space, " at: ");
SUI_DeclareString(space_chars_from_user, " charactors from the user");
SUI_DeclareString(new_wheel_chosen, "New Wheel chosen: ");
SUI_DeclareString(new_rpm_chosen, "New RPM chosen: ");
SUI_DeclareString(current_pattern, "Currently selected Wheel pattern: ");
SUI_DeclareString(fixed_current_rpm, "Fixed RPM mode, Currently: ");
SUI_DeclareString(swept_rpm_from, "Swept RPM mode From: ");
SUI_DeclareString(wheel_direction_colon_space, "Wheel Direction: ");
SUI_DeclareString(signal, "Signal");
SUI_DeclareString(rpm_per_sec_colon_space, "RPM/sec: ");
SUI_DeclareString(space_rpm_per_sec, " RPM/sec");
SUI_DeclareString(normal_, "Normal");
SUI_DeclareString(inverted_, "Inverted");
SUI_DeclareString(reversed_, "Reversed");
SUI_DeclareString(primary_space_signal_colon_space, "Primary Signal: ");
SUI_DeclareString(secondary_space_signal_colon_space, "Secondary Signal: ");
SUI_DeclareString(low_RPM_colon_space, "Low RPM: ");
SUI_DeclareString(high_RPM_colon_space, "High RPM: ");
SUI_DeclareString(range_error,"Range error !(10-50000,10-50000,1-50000)!");
SUI_DeclareString(number_of_matches,"Number of successful matches (should be 3): ");
SUI_DeclareString(sweeping_from_colon_space,"Sweeping from: ");
SUI_DeclareString(swept_RPM_mode,"Swept RPM Mode");
SUI_DeclareString(fixed_RPM_mode,"Fixed RPM Mode");
#endif
/* vim: set syntax=c expandtab sw=2 softtabstop=2 autoindent smartindent smarttab : */
/*
* Arbritrary wheel pattern generator wheel definitions
* vim: filetype=c expandtab shiftwidth=2 tabstop=2 softtabstop=2:
*
* copyright 2014 David J. Andruczyk
* Arbritrary crank/cam wheel pattern generator
*
* copyright 2014-2017 David J. Andruczyk
*
* Ardu-Stim software is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -18,6 +19,7 @@
* along with any ArduStim software. If not, see http://www.gnu.org/licenses/
*
*/
#ifndef __STRUCTURES_H__
#define __STRUCTURES_H__
......@@ -37,7 +39,7 @@ struct _sweep_step {
/* Tie things wheel related into one nicer structure ... */
typedef struct _wheels wheels;
struct _wheels {
const char *decoder_name PROGMEM;
const char* decoder_name PROGMEM;
const unsigned char *edge_states_ptr PROGMEM;
const float rpm_scaler;
const uint16_t wheel_max_edges;
......
/* vim: set syntax=c expandtab sw=2 softtabstop=2 autoindent smartindent smarttab : */
/*
* Arbritrary wheel pattern generator
* vim: filetype=c expandtab shiftwidth=2 tabstop=2 softtabstop=2:
*
* copyright 2014 David J. Andruczyk
* Arbritrary crank/cam wheel pattern generator
*
* copyright 2014-2017 David J. Andruczyk
*
* Ardu-Stim software is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -41,7 +42,6 @@
sweep_step *build_sweep_steps(uint32_t *low_rpm_tcnt, uint32_t *high_rpm_tcnt, uint8_t *total_stages)
{
sweep_step *steps;
uint8_t prescaler_bits;
uint8_t bitshift;
uint32_t tmp = *low_rpm_tcnt;
/* DEBUG
......
/* vim: filetype=c expandtab shiftwidth=2 tabstop=2 softtabstop=2:
*/
/*
* vim: filetype=c expandtab shiftwidth=2 tabstop=2 softtabstop=2:
*
* Arbritrary crank/cam wheel pattern generator
*
* copyright 2014-2016 David J. Andruczyk
* copyright 2014-2017 David J. Andruczyk
*
* Ardu-Stim software is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......
/* vim: set syntax=c expandtab sw=2 softtabstop=2 autoindent smartindent smarttab : */
/*
* Arbritrary wheel pattern generator wheel definitions
* vim: filetype=c expandtab shiftwidth=2 tabstop=2 softtabstop=2:
*
* copyright 2015 David J. Andruczyk
* Arbritrary crank/cam wheel pattern generator
*
* copyright 2014-2017 David J. Andruczyk
*
* Ardu-Stim software is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -18,12 +19,13 @@
* along with any ArduStim software. If not, see http://www.gnu.org/licenses/
*
*/
#ifndef __USER_DEFAULTS_H__
#define __USER_DEFAULTS_H__
#include "wheel_defs.h"
#define DEFAULT_RPM 6000
#define DEFAULT_WHEEL FOUR_G_SIXTY_THREE_WITH_CAM
#define DEFAULT_WHEEL DIZZY_FOUR_CYLINDER
#endif
/* vim: set syntax=c expandtab sw=2 softtabstop=2 autoindent smartindent smarttab : */
/*
* Arbritrary wheel pattern generator wheel definitions
* vim: filetype=c expandtab shiftwidth=2 tabstop=2 softtabstop=2:
*
* Copyright 2014-2016 David J. Andruczyk
* Arbritrary crank/cam wheel pattern generator
*
* copyright 2014-2017 David J. Andruczyk
*
* Ardu-Stim software is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -18,10 +19,12 @@
* along with any ArduStim software. If not, see http://www.gnu.org/licenses/
*
*/
#ifndef __WHEEL_DEFS_H__
#define __WHEEL_DEFS_H__
#include <avr/pgmspace.h>
#include <SerialUI.h>
/* Wheel patterns!
*
......
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; http://docs.platformio.org/page/projectconf.html
[env:uno]
platform = atmelavr
board = uno
framework = arduino