some updates
parent
f70bc63d18
commit
4d047f4627
38
src/app.tsx
38
src/app.tsx
|
@ -1,16 +1,16 @@
|
|||
import * as React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import * as React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import * as _ from "lodash";
|
||||
import { init, error } from "farmbot-toastr";
|
||||
import { NavBar } from "./nav";
|
||||
import { Everything, Log } from "./interfaces";
|
||||
import { Spinner } from "./spinner";
|
||||
import { init, error } from "farmbot-toastr";
|
||||
import { NavBar } from "./nav";
|
||||
import { Everything, Log } from "./interfaces";
|
||||
import { Spinner } from "./spinner";
|
||||
import { BotState } from "./devices/interfaces";
|
||||
import { ResourceName, TaggedUser } from "./resources/tagged_resources";
|
||||
import { selectAllLogs, maybeFetchUser } from "./resources/selectors";
|
||||
|
||||
/** Remove 300ms delay on touch devices - https://github.com/ftlabs/fastclick */
|
||||
let fastClick = require("fastclick");
|
||||
let fastClick = require("fastclick");
|
||||
fastClick.attach(document.body);
|
||||
|
||||
/** For the logger module */
|
||||
|
@ -20,10 +20,10 @@ init();
|
|||
* If the sync object takes more than 10s to load, the user will be granted
|
||||
* access into the app, but still warned.
|
||||
*/
|
||||
const TIMEOUT_MESSAGE = `App could not be fully loaded, we recommend you try
|
||||
const TIMEOUT_MESSAGE = `App could not be fully loaded, we recommend you try
|
||||
refreshing the page.`;
|
||||
|
||||
interface AppProps {
|
||||
interface AppProps {
|
||||
dispatch: Function;
|
||||
loaded: ResourceName[];
|
||||
logs: Log[];
|
||||
|
@ -31,8 +31,8 @@ interface AppProps {
|
|||
bot: BotState;
|
||||
}
|
||||
|
||||
function mapStateToProps(props: Everything): AppProps {
|
||||
return {
|
||||
function mapStateToProps(props: Everything): AppProps {
|
||||
return {
|
||||
dispatch: props.dispatch,
|
||||
user: maybeFetchUser(props.resources.index),
|
||||
bot: props.bot,
|
||||
|
@ -61,20 +61,20 @@ export default class App extends React.Component<AppProps, {}> {
|
|||
|
||||
get isLoaded() {
|
||||
return (MUST_LOAD.length ===
|
||||
_.intersection(this.props.loaded, MUST_LOAD).length);
|
||||
_.intersection(this.props.loaded, MUST_LOAD).length);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
componentDidMount() {
|
||||
setTimeout(() => {
|
||||
if (!this.isLoaded) {
|
||||
this.props.dispatch({ type: "SYNC_TIMEOUT_EXCEEDED" });
|
||||
if (!this.isLoaded) {
|
||||
this.props.dispatch({ type: "SYNC_TIMEOUT_EXCEEDED" });
|
||||
error(TIMEOUT_MESSAGE, "Warning");
|
||||
}
|
||||
}, 10000);
|
||||
}
|
||||
|
||||
render() {
|
||||
let syncLoaded = this.isLoaded;
|
||||
render() {
|
||||
let syncLoaded = this.isLoaded;
|
||||
return <div className="app">
|
||||
<NavBar
|
||||
user={this.props.user}
|
||||
|
@ -82,8 +82,8 @@ export default class App extends React.Component<AppProps, {}> {
|
|||
dispatch={this.props.dispatch}
|
||||
logs={this.props.logs}
|
||||
/>
|
||||
{!syncLoaded && <Spinner radius={33} strokeWidth={6} />}
|
||||
{syncLoaded && this.props.children}
|
||||
{!syncLoaded && <Spinner radius={33} strokeWidth={6} />}
|
||||
{syncLoaded && this.props.children}
|
||||
</div>;
|
||||
}
|
||||
}
|
||||
|
|
110
src/constants.ts
110
src/constants.ts
|
@ -11,19 +11,19 @@ export namespace ToolTips {
|
|||
`Use these manual control buttons to move FarmBot in realtime. Press the
|
||||
arrows for relative movements or type in new coordinates and press GO for an
|
||||
absolute movement. Tip: Press the Home button when you are done so FarmBot
|
||||
is ready to get back to work.`
|
||||
is ready to get back to work.`;
|
||||
|
||||
export const WEBCAM_SAVE =
|
||||
`Press the edit button to update and save your webcam URL.`
|
||||
`Press the edit button to update and save your webcam URL.`;
|
||||
|
||||
export const PERIPHERALS =
|
||||
`Use these toggle switches to control FarmBot's peripherals in realtime. To
|
||||
edit and create new peripherals, press the EDIT button. Make sure to turn
|
||||
things off when you're done!`
|
||||
things off when you're done!`;
|
||||
|
||||
// Device
|
||||
export const OS_SETTINGS =
|
||||
`View and change device settings.`
|
||||
`View and change device settings.`;
|
||||
|
||||
export const HW_SETTINGS =
|
||||
`Change settings of your FarmBot hardware with the fields below. Caution:
|
||||
|
@ -31,123 +31,123 @@ export namespace ToolTips {
|
|||
Make sure to test any new settings before letting your FarmBot use them
|
||||
unsupervised. Tip: Recalibrate FarmBot after changing settings and test a
|
||||
few sequences to verify that everything works as expected. Note: Currently
|
||||
not all settings can be changed.`
|
||||
not all settings can be changed.`;
|
||||
|
||||
// Hardware Settings: Homing and Calibration
|
||||
export const HOMING =
|
||||
`(Alpha) If encoders or end-stops are enabled, home axis (find zero).`
|
||||
`(Alpha) If encoders or end-stops are enabled, home axis (find zero).`;
|
||||
|
||||
export const CALIBRATION =
|
||||
`(Alpha) If encoders or end-stops are enabled, home axis and determine
|
||||
maximum.`
|
||||
maximum.`;
|
||||
|
||||
export const SET_ZERO_POSITION =
|
||||
`Set the current location as zero.`
|
||||
`Set the current location as zero.`;
|
||||
|
||||
export const FIND_HOME_ON_BOOT =
|
||||
`If encoders or end-stops are enabled, find the home position when the
|
||||
device powers on.`
|
||||
device powers on.`;
|
||||
|
||||
export const STOP_AT_HOME =
|
||||
`Stop at the home location of the axis.`
|
||||
`Stop at the home location of the axis.`;
|
||||
|
||||
export const STOP_AT_MAX =
|
||||
`Don't allow movement past the maximum value provided in AXIS LENGTH.`
|
||||
`Don't allow movement past the maximum value provided in AXIS LENGTH.`;
|
||||
|
||||
export const NEGATIVE_COORDINATES_ONLY =
|
||||
`Restrict travel to negative coordinate locations. Overridden by disabling
|
||||
STOP AT HOME.`
|
||||
STOP AT HOME.`;
|
||||
|
||||
export const LENGTH =
|
||||
`Set the length of each axis to provide software limits. Used only if
|
||||
STOP AT MAX is enabled.`
|
||||
STOP AT MAX is enabled.`;
|
||||
|
||||
export const TIMEOUT_AFTER =
|
||||
`Amount of time to wait for a command to execute before stopping.`
|
||||
`Amount of time to wait for a command to execute before stopping.`;
|
||||
|
||||
// Hardware Settings: Motors
|
||||
export const MAX_MOVEMENT_RETRIES =
|
||||
`Number of times to retry a movement before stopping.`
|
||||
`Number of times to retry a movement before stopping.`;
|
||||
|
||||
export const MAX_SPEED =
|
||||
`Maximum travel speed after acceleration in motor steps per second.`
|
||||
`Maximum travel speed after acceleration in motor steps per second.`;
|
||||
|
||||
export const MIN_SPEED =
|
||||
`Minimum movement speed. Also used for homing, calibration, and movements
|
||||
across home.`
|
||||
across home.`;
|
||||
|
||||
export const ACCELERATE_FOR =
|
||||
`Number of steps used for acceleration and deceleration.`
|
||||
`Number of steps used for acceleration and deceleration.`;
|
||||
|
||||
export const STEPS_PER_MM =
|
||||
`The number of motor steps required to move the axis one millimeter.`
|
||||
`The number of motor steps required to move the axis one millimeter.`;
|
||||
|
||||
export const ALWAYS_POWER_MOTORS =
|
||||
`Keep power applied to motors. Prevents slipping from gravity in certain
|
||||
situations.`
|
||||
situations.`;
|
||||
|
||||
export const INVERT_MOTORS =
|
||||
`Invert direction of motor during calibration.`
|
||||
`Invert direction of motor during calibration.`;
|
||||
|
||||
export const ENABLE_X2_MOTOR =
|
||||
`Enable use of a second x-axis motor. Connects to E0 on RAMPS.`
|
||||
`Enable use of a second x-axis motor. Connects to E0 on RAMPS.`;
|
||||
|
||||
// Hardware Settings: Encoders and Endstops
|
||||
export const ENABLE_ENCODERS =
|
||||
`(Alpha) Enable use of rotary encoders during calibration and homing.`
|
||||
`(Alpha) Enable use of rotary encoders during calibration and homing.`;
|
||||
|
||||
export const ENCODER_POSITIONING =
|
||||
`[EXPERIMENTAL] Use encoders for positioning.`
|
||||
`[EXPERIMENTAL] Use encoders for positioning.`;
|
||||
|
||||
export const INVERT_ENCODERS =
|
||||
`(Alpha) Reverse the direction of encoder position reading.`
|
||||
`(Alpha) Reverse the direction of encoder position reading.`;
|
||||
|
||||
export const MAX_MISSED_STEPS =
|
||||
`(Alpha) Number of steps missed (determined by encoder) before motor is
|
||||
considered to have stalled.`
|
||||
considered to have stalled.`;
|
||||
|
||||
export const ENCODER_MISSED_STEP_DECAY =
|
||||
`(Alpha) Reduction to missed step total for every good step.`
|
||||
`(Alpha) Reduction to missed step total for every good step.`;
|
||||
|
||||
export const ENCODER_SCALING =
|
||||
`(Alpha) encoder scaling factor = 100 * (motor resolution * microsteps) /
|
||||
(encoder resolution)`
|
||||
(encoder resolution).`;
|
||||
|
||||
export const ENABLE_ENDSTOPS =
|
||||
`Enable use of electronic end-stops during calibration and homing.`
|
||||
`Enable use of electronic end-stops during calibration and homing.`;
|
||||
|
||||
export const INVERT_ENDPOINTS =
|
||||
`Swap axis end-stops during calibration.`
|
||||
`Swap axis end-stops during calibration.`;
|
||||
|
||||
// Farmware
|
||||
export const FARMWARE =
|
||||
`Manage Farmware (plugins).`
|
||||
`Manage Farmware (plugins).`;
|
||||
|
||||
export const PHOTOS =
|
||||
`Take and view photos with your FarmBot's camera.`
|
||||
`Take and view photos with your FarmBot's camera.`;
|
||||
|
||||
export const WEED_DETECTOR =
|
||||
`Detect weeds using FarmBot's camera and display them on the Farm Designer
|
||||
map.`
|
||||
map.`;
|
||||
|
||||
export const CAMERA_CALIBRATION =
|
||||
`Calibrate FarmBot's camera for use in the weed detection software.`
|
||||
`Calibrate FarmBot's camera for use in the weed detection software.`;
|
||||
|
||||
// Sequences
|
||||
export const SEQUENCE_COMMANDS =
|
||||
`These are the most basic commands FarmBot can execute. Drag and drop them
|
||||
to create sequences for watering, planting seeds, measuring soil properties,
|
||||
and more.`
|
||||
and more.`;
|
||||
|
||||
export const SEQUENCE_EDITOR =
|
||||
`Drag and drop commands here to create sequences for watering, planting
|
||||
seeds, measuring soil properties, and more. Press the Test button to
|
||||
immediately try your sequence with FarmBot. You can also edit, copy, and
|
||||
delete existing sequences; assign a color; and give your commands custom
|
||||
names.`
|
||||
names.`;
|
||||
|
||||
export const SEQUENCE_LIST =
|
||||
`Here is the list of all of your sequences. Click one to edit.`
|
||||
`Here is the list of all of your sequences. Click one to edit.`;
|
||||
|
||||
export const MOVE_ABSOLUTE =
|
||||
`The Move Absolute step instructs FarmBot to move to the specified
|
||||
|
@ -159,7 +159,7 @@ export namespace ToolTips {
|
|||
Offsets allow you to more easily instruct FarmBot to move to a location,
|
||||
but offset from it by the specified amount. For example moving to just
|
||||
above where a peripheral is located. Using offsets lets FarmBot do the
|
||||
math for you.`
|
||||
math for you.`;
|
||||
|
||||
export const MOVE_RELATIVE =
|
||||
`The Move Relative step instructs FarmBot to move the specified distance
|
||||
|
@ -169,71 +169,72 @@ export namespace ToolTips {
|
|||
it will move diagonally. If you require straight movements along one axis
|
||||
at a time, use multiple Move Relative steps. Move Relative steps should be
|
||||
preceded by a Move Absolute step to ensure you are starting from a known
|
||||
location.`
|
||||
location.`;
|
||||
|
||||
export const WRITE_PIN =
|
||||
`The Write Pin step instructs FarmBot to set the specified pin on the
|
||||
Arduino to the specified mode and value. A Pin Mode of 0 is for on/off
|
||||
control, while a Pin Mode of 1 is for PWM (pulse width modulation) (0-255).`
|
||||
control, while a Pin Mode of 1 is for PWM (pulse width modulation)
|
||||
(0-255).`;
|
||||
|
||||
export const READ_PIN =
|
||||
`The Read Pin step instructs FarmBot to read the current value of the
|
||||
specified pin. A Pin Mode of 0 is for digital (on/off), while a Pin Mode
|
||||
of 1 is for analog (0-1023 for 0-5V).`
|
||||
of 1 is for analog (0-1023 for 0-5V).`;
|
||||
|
||||
export const WAIT =
|
||||
`The Wait step instructs FarmBot to wait for the specified amount of time.
|
||||
Use it in combination with the Pin Write step to water for a length of
|
||||
time.`
|
||||
time.`;
|
||||
|
||||
export const SEND_MESSAGE =
|
||||
`The Send Message step instructs FarmBot to send a custom message to the
|
||||
logs (and toast message and/or email, if selected). This can help you with
|
||||
debugging your sequences.`
|
||||
debugging your sequences.`;
|
||||
|
||||
export const FIND_HOME =
|
||||
`The Find Home step instructs the device to perform a homing command to
|
||||
find and set zero for the chosen axis or axes.`
|
||||
find and set zero for the chosen axis or axes.`;
|
||||
|
||||
export const IF =
|
||||
`Execute a sequence if a condition is satisfied. If the condition is not
|
||||
satisfied, chose to do nothing or execute a different sequence.`
|
||||
satisfied, chose to do nothing or execute a different sequence.`;
|
||||
|
||||
export const EXECUTE_SCRIPT =
|
||||
`The Run Farmware step runs a Farmware package. The weed detection script
|
||||
is the only script supported at the moment, but user definable script
|
||||
support is coming soon!`
|
||||
support is coming soon!`;
|
||||
|
||||
export const TAKE_PHOTO =
|
||||
`Snaps a photo using the device camera. Select the camera type on the
|
||||
Device page.`
|
||||
Device page.`;
|
||||
|
||||
// Regimens
|
||||
export const BULK_SCHEDULER =
|
||||
`Add sequences to your regimen by selecting a sequence from the drop down,
|
||||
specifying a time, choosing which days it should run on, and then clicking
|
||||
the + button. For example: a Seeding sequence might be scheduled for Day 1,
|
||||
while a Watering sequence would be scheduled to run every other day.`
|
||||
while a Watering sequence would be scheduled to run every other day.`;
|
||||
|
||||
export const REGIMEN_EDITOR =
|
||||
`Regimens allow FarmBot to take care of a plant throughout its entire life.
|
||||
A regimen consists of many sequences that are scheduled to run based on the
|
||||
age of the plant. Regimens are applied to plants from the farm designer
|
||||
(coming soon) and can be re-used on many plants growing at the same or
|
||||
different times. Multiple regimens can be applied to any one plant.`
|
||||
different times. Multiple regimens can be applied to any one plant.`;
|
||||
|
||||
export const REGIMEN_LIST =
|
||||
`This is a list of all of your regimens. Click one to begin editing it.`
|
||||
`This is a list of all of your regimens. Click one to begin editing it.`;
|
||||
|
||||
// Tools
|
||||
export const TOOL_LIST =
|
||||
`This is a list of all your FarmBot Tools. Click the Edit button to add,
|
||||
edit, or delete tools.`
|
||||
edit, or delete tools.`;
|
||||
|
||||
export const TOOLBAY_LIST =
|
||||
`Toolbays are where you store your FarmBot Tools. Each Toolbay has Slots
|
||||
that you can put your Tools in, which should be reflective of your real
|
||||
FarmBot hardware configuration.`
|
||||
FarmBot hardware configuration.`;
|
||||
|
||||
}
|
||||
|
||||
|
@ -248,7 +249,7 @@ export namespace Content {
|
|||
your FarmBot so that is goes back into configuration mode for pairing with
|
||||
another user account. When this happens, all of the data on your FarmBot
|
||||
will be overwritten with the new account's data. If the account is brand
|
||||
new, then FarmBot will become a blank slate.`
|
||||
new, then FarmBot will become a blank slate.`;
|
||||
|
||||
// Controls
|
||||
export const FACTORY_RESET_WARNING =
|
||||
|
@ -257,7 +258,8 @@ export namespace Content {
|
|||
home wifi. Upon factory resetting, your device will restart into
|
||||
Configurator mode. Factory resetting your FarmBot will not affect any data
|
||||
or settings from your web app account, allowing you to do a complete restore
|
||||
to your device once it is back online and paired with your web app account.`
|
||||
to your device once it is back online and paired with your web app
|
||||
account.`;
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue