Pre-1.9.5 shut_down_in replacement

6 replies [Last post]
Beta
Beta's picture
Title: The Magnificent
Joined: 02/24/2012
Posts:
BotPoints: 266
User offline. Last seen 9 years 15 weeks ago.

Hi,

Here is a drop-in replacement for shut_down_in you can use in your program. This is meant for teams who DO NOT want to update to 1.9.5 the day before the tournament. This shut_down_in will stop the create automatically. There are no other functional changes. Paste this block at the beginning of your program. No other changes to your program are necessary.

  1. // BEGIN SHUT_DOWN_IN_REPLACEMENT //
  2.  
  3. // Drop-in replacement for shut_down_in.
  4. // Paste the following at the beginning of
  5. // your program.
  6.  
  7. #define shut_down_in(x) __shut_down_in(x)
  8.  
  9. double __shutdown_time;
  10.  
  11. void __shut_down_in_thread()
  12. {
  13. const double start = seconds();
  14. msleep(__shutdown_time * 1000.0);
  15. const double end = seconds();
  16. printf("Shutdown after %lf seconds\n", end - start);
  17. create_stop();
  18.  
  19. // Hard halt process with no cleanup
  20. _Exit(0);
  21. }
  22.  
  23. void __shut_down_in(double secs)
  24. {
  25. printf("Using shut_down_in replacement\n");
  26. __shutdown_time = secs;
  27. thread t = thread_create(__shut_down_in_thread);
  28. thread_start(t);
  29. }
  30.  
  31. // END SHUT_DOWN_IN REPLACEMENT //

Check to make sure it is working by looking for the line "Using shut_down_in replacement" in your program's output.

If you are wanting to update to 1.9.5, please see the firmware update page on kipr.org.

Braden McDorman

Developer of the KIPR Link, KISS IDE, KIPR's 2D Simulator, and CBCJVM.

Reach me at bmcdorman(cat)kipr(dog)org where (cat)=@ and (dog)=. if you need assistance of any kind.

lspangler
Title: NooBot
Joined: 02/25/2013
Posts:
BotPoints: 8
User offline. Last seen 10 years 11 weeks ago.

How would you do this using C++?

ruler501
ruler501's picture
Title: NooBot
Joined: 01/29/2012
Posts:
BotPoints: 367
User offline. Last seen 8 years 3 weeks ago.

if you surround it by extern "C"
{
}
It should work.
NOTE: I have not tested this and I may have typed something wrong.

Beta
Beta's picture
Title: The Magnificent
Joined: 02/24/2012
Posts:
BotPoints: 266
User offline. Last seen 9 years 15 weeks ago.

The code will work unmodified in C++ if you #include <kovan/kovan.h> before it.

Braden McDorman

Developer of the KIPR Link, KISS IDE, KIPR's 2D Simulator, and CBCJVM.

Reach me at bmcdorman(cat)kipr(dog)org where (cat)=@ and (dog)=. if you need assistance of any kind.

Unblock game
Title: NooBot
Joined: 07/25/2017
Posts:
BotPoints: 10
User offline. Last seen 4 years 17 weeks ago.

Hi guys if you are working on bing if you are using bing search engine then you earn bing rewards point thank you

jiya
Title: NooBot
Joined: 06/06/2017
Posts:
BotPoints: 110
User offline. Last seen 1 year 3 weeks ago.

How do we shut down in replacement? You have not mentioned any techniques on this page and it is very difficult for the people to know about it too. Please share some details on this page as how to do a proper replacement. http://www.cushioncutengagementring.com/

Kaitlyn John
Title: NooBot
Joined: 03/28/2019
Posts:
BotPoints: 14
User offline. Last seen 47 weeks 3 days ago.

Thanks a lot for the code you have shared here and it was so helpful for us that helps in trying out and everything you have explained here really help us to understand the program in a better way and keep on sharing more such informative post Buy CBD Products Online